Changeset - 090935e00933
[Not reviewed]
0 5 0
MH - 4 years ago 2021-12-03 15:48:54
contact@maxhenger.nl
Remove debug logging
5 files changed with 2 insertions and 96 deletions:
0 comments (0 inline, 0 general)
src/protocol/parser/pass_tokenizer.rs
Show inline comments
 
@@ -786,77 +786,3 @@ fn maybe_number_remaining(c: u8) -> bool {
 
            (c >= b'0' && c <= b'9') || (c >= b'A' && c <= b'F') || (c >= b'a' && c <= b'f') ||
 
            c == b'_';
 
}
 

	
 
#[cfg(test)]
 
mod tests {
 
    use super::*;
 

	
 
    // TODO: Remove at some point
 
    #[test]
 
    fn test_tokenizer() {
 
        let mut source = InputSource::new_test("
 

	
 
        #version 500
 
        # hello 2
 

	
 
        import std.reo::*;
 

	
 
        struct Thing {
 
            int a: 5,
 
        }
 
        enum Hello {
 
            A,
 
            B
 
        }
 

	
 
        // Hello hello, is it me you are looking for?
 
        // I can seee it in your eeeyes
 

	
 
        func something(int a, int b, int c) -> byte {
 
            int a = 5;
 
            struct Inner {
 
                int a
 
            }
 
            struct City {
 
                int b
 
            }
 
            /* Waza
 
            How are you doing
 
            Things in here yo
 
            /* */ */
 

	
 
            a = a + 5 * 2;
 
            struct Pressure {
 
                int d
 
            }
 
        }
 
        ");
 
        let mut t = PassTokenizer::new();
 
        let mut buffer = TokenBuffer::new();
 
        t.tokenize(&mut source, &mut buffer).expect("tokenize");
 

	
 
        println!("Ranges:\n");
 
        for (idx, range) in buffer.ranges.iter().enumerate() {
 
            println!("[{}] {:?}", idx, range)
 
        }
 

	
 
        println!("Tokens:\n");
 
        let mut iter = buffer.tokens.iter().enumerate();
 
        while let Some((idx, token)) = iter.next() {
 
            match token.kind {
 
                TokenKind::Ident | TokenKind::Pragma | TokenKind::Integer |
 
                TokenKind::String | TokenKind::Character | TokenKind::LineComment |
 
                TokenKind::BlockComment => {
 
                    let (_, end) = iter.next().unwrap();
 
                    println!("[{}] {:?} ......", idx, token.kind);
 
                    assert_eq!(end.kind, TokenKind::SpanEnd);
 
                    let text = source.section_at_pos(token.pos, end.pos);
 
                    println!("{}", String::from_utf8_lossy(text));
 
                },
 
                _ => {
 
                    println!("[{}] {:?}", idx, token.kind);
 
                }
 
            }
 
        }
 
    }
 
}
 
\ No newline at end of file
src/runtime/connector.rs
Show inline comments
 
@@ -245,7 +245,6 @@ impl ConnectorPDL {
 
    }
 

	
 
    pub fn handle_new_sync_comp_message(&mut self, message: SyncCompMessage, ctx: &mut ComponentCtx) -> Option<ConnectorScheduling> {
 
        println!("DEBUG: Actually really handling {:?}", message);
 
        if let Some(round_conclusion) = self.consensus.handle_new_sync_comp_message(message, ctx) {
 
            return Some(self.enter_non_sync_mode(round_conclusion, ctx));
 
        }
 
@@ -412,9 +411,7 @@ impl ConnectorPDL {
 
                        self.eval_error = Some(eval_error);
 
                        self.mode = Mode::SyncError;
 

	
 
                        println!("DEBUGERINO: Notify of fatal branch");
 
                        if let Some(conclusion) = self.consensus.notify_of_fatal_branch(branch_id, comp_ctx) {
 
                            println!("DEBUGERINO: Actually got {:?}", conclusion);
 
                            return self.enter_non_sync_mode(conclusion, comp_ctx);
 
                        }
 
                    }
src/runtime/consensus.rs
Show inline comments
 
@@ -172,7 +172,6 @@ impl Consensus {
 
        // the consensus algorithm
 
        let branch = &self.branch_annotations[failed_branch_id.index as usize];
 
        if branch.channel_mapping.iter().all(|v| v.registered_id.is_none()) {
 
            println!("DEBUG: Failure everything silent");
 
            return Some(RoundConclusion::Failure);
 
        }
 

	
 
@@ -302,7 +301,6 @@ impl Consensus {
 
        let _branch = &self.branch_annotations[branch_id.index as usize];
 

	
 
        // Clear out internal storage to defaults
 
        println!("DEBUG: ***** Incrementing sync round stuff");
 
        self.highest_connector_id = ConnectorId::new_invalid();
 
        self.branch_annotations.clear();
 
        self.branch_markers.clear();
 
@@ -319,8 +317,6 @@ impl Consensus {
 
            peer.encountered_this_round = false;
 
            peer.expected_sync_round += 1;
 
        }
 

	
 
        println!("DEBUG: ***** Peers post round are:\n{:#?}", &self.peers)
 
    }
 

	
 
    // --- Handling messages
 
@@ -432,7 +428,6 @@ impl Consensus {
 
            },
 
            SyncCompContent::GlobalFailure => {
 
                // Global failure of round, send Ack to leader
 
                println!("DEBUGERINO: Got GlobalFailure, sending Ack in response");
 
                debug_assert_ne!(self.highest_connector_id, ctx.id); // not the leader
 
                let _result = self.send_to_leader_or_handle_as_leader(SyncCompContent::AckFailure, ctx);
 
                debug_assert!(_result.is_none());
 
@@ -591,7 +586,6 @@ impl Consensus {
 
    fn handle_received_sync_header(&mut self, sync_header: SyncHeader, ctx: &mut ComponentCtx) -> MessageOrigin {
 
        debug_assert!(sync_header.sending_component_id != ctx.id); // not sending to ourselves
 
        let origin = self.handle_peer(&sync_header);
 
        println!(" ********************** GOT {:?}", origin);
 
        if origin != MessageOrigin::Present {
 
            // We do not have to handle it now
 
            return origin;
 
@@ -809,7 +803,6 @@ impl Consensus {
 
            }
 
        }
 

	
 
        println!("DEBUGERINO: Leader entering error state, we need to wait on {:?}", encountered.iter().map(|v| v.index).collect::<Vec<_>>());
 
        self.conclusion = Some(RoundConclusion::Failure);
 
        if encountered.is_empty() {
 
            // We don't have to wait on Acks
 
@@ -845,7 +838,6 @@ impl Consensus {
 

	
 
        let maybe_conclusion = self.send_to_leader_or_handle_as_leader(SyncCompContent::LocalFailure, ctx);
 
        debug_assert!(if maybe_already.is_some() { maybe_conclusion.is_some() } else { true });
 
        println!("DEBUG: Maybe conclusion is {:?}", maybe_conclusion);
 

	
 
        // Initiate a discovery wave so peers can do the same
 
        self.handled_wave = true;
 
@@ -1225,8 +1217,6 @@ impl SolutionCombiner {
 
            }
 
        }
 

	
 
        println!("DEBUGGERINO Presence is now:\n{:#?}", self.presence);
 

	
 
        return self.check_for_global_failure();
 
    }
 

	
 
@@ -1473,11 +1463,9 @@ impl SolutionCombiner {
 
        }
 

	
 
        // Handle channel presence
 
        println!("DEBUGERINO: Presence before joining is {:#?}", &self.presence);
 
        if self.presence.is_empty() {
 
            // Trivial case
 
            self.presence = combiner.presence;
 
            println!("DEBUGERINO: Trivial merging")
 
        } else {
 
            for presence in combiner.presence {
 
                match self.presence.iter_mut().find(|v| v.id == presence.id) {
 
@@ -1509,11 +1497,9 @@ impl SolutionCombiner {
 
                    }
 
                }
 
            }
 
            println!("DEBUGERINO: Presence after joining is {:#?}", &self.presence);
 

	
 
            // After adding everything we might have immediately found a solution
 
            if self.check_for_global_failure() {
 
                println!("DEBUG: Returning immediate failure?");
 
                return Some(LeaderConclusion::Failure);
 
            }
 
        }
src/runtime/mod.rs
Show inline comments
 
@@ -592,7 +592,6 @@ impl ConnectorStore {
 
            }
 
        }
 

	
 
        println!("DEBUG [ global store  ] Created component at {}", key.index);
 
        return key;
 
    }
 

	
 
@@ -606,7 +605,6 @@ impl ConnectorStore {
 
            // Note: but not deallocating!
 
        }
 

	
 
        println!("DEBUG [ global store  ] Destroyed component at {}", key.index);
 
        self.free.push(key.index as usize);
 
    }
 
}
src/runtime/scheduler.rs
Show inline comments
 
@@ -411,11 +411,11 @@ impl Scheduler {
 
    }
 

	
 
    fn debug(&self, message: &str) {
 
        println!("DEBUG [thrd:{:02} conn:  ]: {}", self.scheduler_id, message);
 
        // println!("DEBUG [thrd:{:02} conn:  ]: {}", self.scheduler_id, message);
 
    }
 

	
 
    fn debug_conn(&self, conn: ConnectorId, message: &str) {
 
        println!("DEBUG [thrd:{:02} conn:{:02}]: {}", self.scheduler_id, conn.index, message);
 
        // println!("DEBUG [thrd:{:02} conn:{:02}]: {}", self.scheduler_id, conn.index, message);
 
    }
 
}
 

	
 
@@ -543,7 +543,6 @@ impl ComponentCtx {
 
            };
 
            if !is_valid {
 
                // We don't own the port
 
                println!(" ****** DEBUG ****** : Sending through closed port!!! {}", port_id.index);
 
                return Err(());
 
            }
 
        }
0 comments (0 inline, 0 general)