-
Notifications
You must be signed in to change notification settings - Fork 314
Display send/recv in Bps instead of totals in the debug window #305
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
Conversation
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.
Concept ACK
I agree that this is more useful than showing the totals. One can still see the totals by clicking on the peer.
One issue is that Sent
and Received
are now used in two different contexts. In the peer table, it's denoting how many bytes are currently being sent/received. In the sidebar it's denoting the total sent/received.
My suggestion is to change the Sent
/Received
text in the sidebar to Total Sent
/Total Received
.
src/qt/guiutil.h
Outdated
@@ -218,6 +218,7 @@ namespace GUIUtil | |||
QString formatNiceTimeOffset(qint64 secs); | |||
|
|||
QString formatBytes(uint64_t bytes); | |||
QString formatBps(uint64_t bytes); |
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.
Should add doxygen documentation
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.
hmmm. well, the units indicate that it is a different metric, so I'm not sure if the addition of the word "total" is needed. What do other people think?
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.
@jarolrod I don't think doxygen docs exist for formatBytes, so perhaps that can be done in another pull request to do it for a number of functions.
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.
@rebroad
Since you're adding this function (formatBps
) you should add the Doxygen comment with it. formatBytes
not including a Doxygen when it was introduced is another issue that can be addressed in another PR.
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.
@jarolrod given that formatBps is so similar to formatBytes, I'm averse to doing the Doxygen for formatBytes as part of this pull, and I'm also averse to doing Doxygen for just formatBps without formatBytes in this pull, but I'm fine with doing a later pull request to add the Doxygen for both formatBytes and formatBps. I think the Doxygen therefore belongs in a separate pull request tackling a number of missing functions.
src/qt/guiutil.cpp
Outdated
QString formatBps(uint64_t bytes) | ||
{ | ||
if (bytes < 1'000) | ||
return QObject::tr("%1 B/s").arg(bytes); |
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.
should add Translator comments
see: https://doc.qt.io/qt-5/i18n-source-translation.html#translator-comments
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.
@jarolrod does your suggestion still apply now that I've changed it to bps (bits per second)? Is bps different in other languages?
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.
A translator comment is the easiest way to let translators know what "bps" is.
Worth exploring. The sidebar probably should be updated to display the same data, possibly in addition to the totals. |
|
6cfd19b
to
620e138
Compare
ah, thank you - I was wondering if that was possible... the terminology confuses me though as I'd say it's ready for review, but not perhaps ready to be merged. |
620e138
to
817f6be
Compare
I considered doing this, but I think it's an overall advantage to not have too much data there. It's more useful to have bandwidth in the columns, and totals in the sidebar, IMHO. |
What is the base period to calculate data-transfer rate? |
src/qt/guiutil.cpp
Outdated
if (bytes < 10'000) | ||
return QObject::tr("%1 bps").arg(bytes); | ||
if (bytes < 10'000'000) | ||
return QObject::tr("%1 kbps").arg(bytes / 1'000); | ||
if (bytes < 10'000'000'000) | ||
return QObject::tr("%1 Mbps").arg(bytes / 1'000'000); |
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.
if (bytes < 10'000) | |
return QObject::tr("%1 bps").arg(bytes); | |
if (bytes < 10'000'000) | |
return QObject::tr("%1 kbps").arg(bytes / 1'000); | |
if (bytes < 10'000'000'000) | |
return QObject::tr("%1 Mbps").arg(bytes / 1'000'000); | |
if (bytes < 10'000) | |
//: "Bit per second." | |
return QObject::tr("%1 bps").arg(bytes); | |
if (bytes < 10'000'000) | |
//: "Kilobit per second." | |
return QObject::tr("%1 kbps").arg(bytes / 1'000); | |
if (bytes < 10'000'000'000) | |
//: "Megabit per second." | |
return QObject::tr("%1 Mbps").arg(bytes / 1'000'000); |
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.
Oh, just noted that here are bytes not bits. In that case the correct contraction is upper case "B", not "b": Bps, kBps, MBps.
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.
@hebasto actually, they are bits, but I ought to change the variable name to reflect that. Will do so, and thanks for the guidance on the commentation.
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.
Oh, just noted that here are bytes not bits. In that case the correct contraction is upper case "B", not "b": Bps, kBps, MBps.
why is the k small but the M is big?
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.
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.
ah, ok. will change.
In my first pull request it was from connection time to current time. Now it's from connection time to time of last send/recv. |
7ba85be
to
22ecf65
Compare
Maybe have both and let the user decide which to hide/show? |
where would you place the option? |
3a32569
to
9260220
Compare
Just have 4 columns, total in, total out, rate in, rate out. Other applications let you rightclick the header area to hide/show them, but even if we can't have that, users can resize them to ~0 width. |
9260220
to
cf39e7d
Compare
It's a pain having to resize columns, and also they cannot be resized to zero. I'd rather wait until there's the ability to disable columns before creating a pull to add rate in addition to total bytes. There are already too many columns IMHO. |
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.
Tested ACK cf39e7d
Compiled and Tested on Ubuntu 20.04
It makes more sense to add the rate of sending and receiving of data than the total as suggested by op.
But I have just one doubt
return GUIUtil::formatBps(rec->nodeStats.nSendBytes * 8 / (rec->nodeStats.nLastSend+1 - rec->nodeStats.nTimeConnected));
By the logic used by op, the displayed rate is the average rate of data transferred by the peer. But I personally would prefer that if the displayed rate was instantaneous and not average because it might happen that a node is inactive for quite some time, but the data they transferred earlier was so high, that the rate column is showing a significantly large rate of data transfer.
And also:
For values larger than 1000 bps the data should be shown in kbps, but it is not happening as in the highlighted example.
I agree. I'll upload an update shortly. |
cf39e7d
to
da35fa3
Compare
Yes, this does happen, for example in the case where there's IBD (initial block download) which has much higher transfer rates and then skews the numbers once that completes. I have another commit, which deals with this, and allows the calculation to be reset at the end of IBD. Shall I include that with this pull, or perhaps raise another pull in the future to include that? |
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.
Changes since my last review:
- The sent data is displayed in kbps when it is greater than 1000bps.
bits
variable has been changed fromuint64_t
tofloat
.- Modifies Sent and Recieve case in
peertablemodel.cpp
to avoid division by zero.
Changing bits variable from int to float has to lead to displaying sent and receive value with decimals. This makes the displayed data look a lot better compared to the previous version. Great Work, @rebroad!
I am adding some screenshots to emphasize the difference between the old commit and the latest commit.
Old Commit | Latest Commit |
---|---|
Shall I include that with this pull, or perhaps raise another pull in the future to include that?
IMO, I think it would be better to add this as an additional commit to this PR. This is a significant change. Let’s not wait for the opening of another and then waiting for it to get merged.
da35fa3
to
c1a692b
Compare
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.
Changes since my last review:
- Correction has been made at line 809:
10'000
->100'000
I have another commit, which deals with this, and allows the calculation to be reset at the end of IBD. Shall I include that with this pull, or perhaps raise another pull in the future to include that?
Any updates on the above. Have you planned on adding it as another commit, or have you decided to do so in a future PR?
@shaavan I am still testing the functionality for resetting at the end of IBD - have you already created a method for detecting this? I'd be interested in having a look at your code if so. |
Unfortunately, not yet. However, I have some ideas on how to do so. Let me try to implement this as soon as possible. |
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Closing due to inactivity. Feel free to reopen. |
Moved from bitcoin/bitcoin#21806
I find this far more useful for than the totals. For example, I can easily see which nodes are not really talking with this metric, and not so much with the totals (as is current functionality).
Example:-