Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time logging #78

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion src/events_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,41 @@ impl<Types: NodeType> EventConsumer<Types> for EventsStreamer<Types> {
};
if filter {
let builder_event = Arc::new(BuilderEvent::from(event));
let _status = self.subscriber_send_channel.broadcast(builder_event).await;

// log the time for sending the event to the subscriber
let start_time = std::time::Instant::now();

let _status = self
.subscriber_send_channel
.broadcast(builder_event.clone())
.await;

let end_time = std::time::Instant::now();
let time_taken = (end_time - start_time).as_millis();

match &builder_event.event {
BuilderEventType::HotshotDaProposal { proposal, .. } => {
tracing::info!(
"Time taken to send DA proposal with encoded txn len {:?} event: {:?}",
proposal.data.encoded_transactions.len(),
time_taken
);
}
BuilderEventType::HotshotQuorumProposal { .. } => {
tracing::info!("Time taken to send Quorum proposal event: {:?}", time_taken);
}
BuilderEventType::HotshotTransactions { transactions } => {
tracing::info!(
"Time taken to send {:?} Transactions event: {:?}",
transactions.len(),
time_taken
);
}
BuilderEventType::HotshotDecide { .. } => {
tracing::info!("Time taken to send Decide event: {:?}", time_taken);
}
_ => {}
}
}
}
}
Expand Down
Loading