-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Performance metrics for NetworkManager
future
#6746
Conversation
crates/net/network/src/manager.rs
Outdated
error!("Network message channel closed."); | ||
return Poll::Ready(()) | ||
let acc = &mut poll_durations.acc_network_handle; | ||
duration_metered_exec!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the macro for those two calls?
with macro this is more verbose than without
we can also get rid of of the second Instant::now if we reuse the previous network handle duration to offset the elpased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's favourable here to be as exact as possible with the start time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find these macros very hard to read, and this adds more code than without the macro.
since we're only using this twice I'd prefer using instants directly, which is just 2 lines and no additional scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to be consistent with pattern introduced in #6688
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, not using a macro makes it easier to read, less code and no additional scope.
and we can also save 1 syscall if we reuse the first instant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I'm not quite sure which instant you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do:
let now = Instant::now();
...
poll_durations.acc_network_handle = now.elpased();
...
poll_durations.acc_swarm = now.elpased() - poll_durations.acc_network_handle;
crates/net/network/src/manager.rs
Outdated
error!("Network message channel closed."); | ||
return Poll::Ready(()) | ||
let acc = &mut poll_durations.acc_network_handle; | ||
duration_metered_exec!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case, not using a macro makes it easier to read, less code and no additional scope.
and we can also save 1 syscall if we reuse the first instant.
…adigmxyz/reth into emhane/poll-duration-network-manager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Closes #6745.
Gauge
s forNetworkManager
future and its nested items, to measure the accumulated time spent in the future on a whole and in each nested item.SwarmEvent
processing to separate function to improve readability of the new code.