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

[dht] Use SpeedMonitor to calculate DHT data rates #490

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

alanmcgovern
Copy link
Owner

Record total bytes sent/received, as well as the estimated transfer rate in bytes/second.

Record total bytes sent/received, as well as the
estimated transfer rate in bytes/second.
@alanmcgovern
Copy link
Owner Author

@YegorStepanov

This should give you the DHT stats you needed. Let me know what you think!

Copy link

@YegorStepanov YegorStepanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Comment on lines +50 to +58
/// <summary>
/// Estimate of the amount of data sent every second, in bytes/second.
/// </summary>
long ReceiveRate { get; }

/// <summary>
/// Estimate of the amount of data sent every second, in bytes/second.
/// </summary>
long SendRate { get; }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful SendRate/ReceiveRate. If I grab the value every second, I want to know the average of the one second. Idk when I want to use the average of the 12 seconds (12 is hard-coded), so it's 'some average'. This value can be displayed only. It cannot be used for any kind of processing.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case I suspect the best solution for you is to iterate over all active connections every N seconds, grab the total bytes sent/received and calculate the delta since the previous time your logic ran.

It would be very hard to provide anything else which isn't prone to skipping a value, or duplicating a value.

If the engine calculated the "average" over the last second, it would be hard to ensure you (the consumer of the library) always read the number exactly once per second.

@alanmcgovern alanmcgovern merged commit 8152272 into master Dec 13, 2021
@alanmcgovern alanmcgovern deleted the dht-transfer-stats branch December 13, 2021 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants