Skip to content

Commit

Permalink
libpcap-analyzer: better wording for worker identifiers in trace/debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pc-anssi committed Nov 25, 2024
1 parent 84eac08 commit 239b302
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libpcap-analyzer/src/threaded_analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub(crate) fn extern_dispatch_l3<'a>(
let n_workers = jobs.len();
let i = fan_out(data, ethertype, n_workers);
debug_assert!(i < n_workers);
// trace!("sending job to worker {i}");
jobs[i]
.send(Job::New(packet, ctx.clone(), data, ethertype))
.or(Err(Error::Generic("Error while sending job")))
Expand Down Expand Up @@ -296,21 +297,21 @@ fn worker(mut a: Analyzer, idx: usize, r: Receiver<Job>, barrier: Arc<Barrier>)
Job::Exit => break,
Job::PrintDebug => {
{
debug!("thread {}: hash table size: {}", idx, a.flows.len());
debug!("worker {}: flow table size: {}", idx, a.flows.len());
};
}
Job::New(packet, ctx, data, ethertype) => {
pcap_index = ctx.pcap_index;
let span = span!(Level::DEBUG, "worker", pcap_index);
let _enter = span.enter();
trace!("thread {}: got a job", idx);
trace!("worker {}: got a job", idx);
let h3_res = handle_l3(&packet, &ctx, data, ethertype, &mut a);
if h3_res.is_err() {
warn!("thread {}: handle_l3 failed", idx);
}
}
Job::Wait => {
trace!("Thread {}: waiting at barrier", idx);
trace!("worker {}: waiting at barrier", idx);
barrier.wait();
}
}
Expand Down

0 comments on commit 239b302

Please sign in to comment.