Display send/recv in Bps instead of totals in the debug window #305

pull rebroad wants to merge 1 commits into bitcoin-core:master from rebroad:SendRecvSpeed-gui changing 6 files +67 −14
  1. rebroad commented at 5:52 pm on April 29, 2021: contributor

    Moved from https://github.com/bitcoin/bitcoin/pull/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:-

    image

  2. rebroad marked this as ready for review on Apr 29, 2021
  3. hebasto added the label Design on Apr 29, 2021
  4. hebasto added the label Feature on Apr 29, 2021
  5. in src/qt/guiutil.h:221 in 6cfd19b682 outdated
    217@@ -218,6 +218,7 @@ namespace GUIUtil
    218     QString formatNiceTimeOffset(qint64 secs);
    219 
    220     QString formatBytes(uint64_t bytes);
    221+    QString formatBps(uint64_t bytes);
    



    rebroad commented at 9:37 pm on April 30, 2021:
    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?

    rebroad commented at 9:41 pm on April 30, 2021:
    @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.

    jarolrod commented at 11:22 pm on April 30, 2021:
    @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.

    rebroad commented at 10:44 pm on May 1, 2021:
    @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.
  6. in src/qt/guiutil.cpp:780 in 6cfd19b682 outdated
    773@@ -774,6 +774,18 @@ QString formatBytes(uint64_t bytes)
    774     return QObject::tr("%1 GB").arg(bytes / 1'000'000'000);
    775 }
    776 
    777+QString formatBps(uint64_t bytes)
    778+{
    779+    if (bytes < 1'000)
    780+        return QObject::tr("%1 B/s").arg(bytes);
    


    jarolrod commented at 6:30 am on April 30, 2021:

    rebroad commented at 9:39 pm on April 30, 2021:
    @jarolrod does your suggestion still apply now that I’ve changed it to bps (bits per second)? Is bps different in other languages?

    hebasto commented at 9:50 am on May 2, 2021:
    A translator comment is the easiest way to let translators know what “bps” is.
  7. jarolrod commented at 6:37 am on April 30, 2021: member

    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.

    305-test

  8. in src/qt/peertablemodel.cpp:127 in 6cfd19b682 outdated
    121@@ -122,9 +122,9 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
    122         case Ping:
    123             return GUIUtil::formatPingTime(rec->nodeStats.m_min_ping_time);
    124         case Sent:
    125-            return GUIUtil::formatBytes(rec->nodeStats.nSendBytes);
    126+            return GUIUtil::formatBps(rec->nodeStats.nSendBytes / (GetSystemTimeInSeconds() + 1 - rec->nodeStats.nTimeConnected));
    127         case Received:
    128-            return GUIUtil::formatBytes(rec->nodeStats.nRecvBytes);
    129+            return GUIUtil::formatBps(rec->nodeStats.nRecvBytes / (GetSystemTimeInSeconds() + 1 - rec->nodeStats.nTimeConnected));
    


    jonatack commented at 7:50 am on April 30, 2021:
    ISTM this calculation will be useful shortly after the connection time but for long-lived peers would provide little to no real-time feedback. Maybe use the time in seconds since last message sent/received like in -netinfo?

    rebroad commented at 9:27 pm on April 30, 2021:
    done

    rebroad commented at 9:40 pm on April 30, 2021:
    @jonatack done
  9. jonatack commented at 7:51 am on April 30, 2021: contributor
    Worth exploring. The sidebar probably should be updated to display the same data, possibly in addition to the totals.
  10. rebroad renamed this:
    Display send/recv in Bps instead of totals in the debug window
    WIP - Display send/recv in Bps instead of totals in the debug window
    on Apr 30, 2021
  11. hebasto commented at 10:28 am on April 30, 2021: member

    @rebroad

    Changed to WIP as I just noticed the column sorting is still using the old values.

    You also could convert it to a draft: DeepinScreenshot_select-area_20210430132714

  12. rebroad force-pushed on Apr 30, 2021
  13. rebroad marked this as a draft on Apr 30, 2021
  14. rebroad commented at 9:30 pm on April 30, 2021: contributor

    @rebroad

    Changed to WIP as I just noticed the column sorting is still using the old values.

    You also could convert it to a draft: DeepinScreenshot_select-area_20210430132714

    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.

  15. rebroad force-pushed on Apr 30, 2021
  16. rebroad commented at 9:42 pm on April 30, 2021: contributor

    Worth exploring. The sidebar probably should be updated to display the same data, possibly in addition to the totals.

    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.

  17. rebroad renamed this:
    WIP - Display send/recv in Bps instead of totals in the debug window
    Display send/recv in Bps instead of totals in the debug window
    on Apr 30, 2021
  18. rebroad marked this as ready for review on Apr 30, 2021
  19. hebasto removed the label Design on May 2, 2021
  20. hebasto added the label UX on May 2, 2021
  21. hebasto commented at 9:44 am on May 2, 2021: member
    What is the base period to calculate data-transfer rate?
  22. in src/qt/guiutil.cpp:784 in 817f6be2c2 outdated
    779+    if (bytes < 10'000)
    780+        return QObject::tr("%1 bps").arg(bytes);
    781+    if (bytes < 10'000'000)
    782+        return QObject::tr("%1 kbps").arg(bytes / 1'000);
    783+    if (bytes < 10'000'000'000)
    784+        return QObject::tr("%1 Mbps").arg(bytes / 1'000'000);
    


    hebasto commented at 9:48 am on May 2, 2021:
    0    if (bytes < 10'000)
    1        //: "Bit per second."
    2        return QObject::tr("%1 bps").arg(bytes);
    3    if (bytes < 10'000'000)
    4        //: "Kilobit per second."
    5        return QObject::tr("%1 kbps").arg(bytes / 1'000);
    6    if (bytes < 10'000'000'000)
    7        //: "Megabit per second."
    8        return QObject::tr("%1 Mbps").arg(bytes / 1'000'000);
    

    hebasto commented at 9:53 am on May 2, 2021:
    Oh, just noted that here are bytes not bits. In that case the correct contraction is upper case “B”, not “b”: Bps, kBps, MBps.

    rebroad commented at 10:16 am on May 7, 2021:
    @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.

    rebroad commented at 10:19 am on May 7, 2021:

    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?



    rebroad commented at 2:31 pm on June 26, 2021:
    ah, ok. will change.
  23. rebroad commented at 10:15 am on May 7, 2021: contributor

    What is the base period to calculate data-transfer rate?

    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.

  24. rebroad force-pushed on May 7, 2021
  25. rebroad force-pushed on May 7, 2021
  26. rebroad force-pushed on May 7, 2021
  27. rebroad force-pushed on May 7, 2021
  28. rebroad force-pushed on May 7, 2021
  29. luke-jr commented at 8:25 pm on June 12, 2021: member
    Maybe have both and let the user decide which to hide/show?
  30. rebroad commented at 2:32 pm on June 26, 2021: contributor

    Maybe have both and let the user decide which to hide/show?

    where would you place the option?

  31. rebroad force-pushed on Jun 26, 2021
  32. rebroad force-pushed on Jun 26, 2021
  33. luke-jr commented at 2:57 pm on June 26, 2021: member

    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.

  34. rebroad force-pushed on Jun 26, 2021
  35. rebroad commented at 3:45 pm on June 26, 2021: contributor

    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.

    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.

  36. shaavan commented at 4:51 pm on July 30, 2021: contributor

    Tested ACK cf39e7d7b17e0affc1214cb2bb64de3f89093679

    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

    0return 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: Screenshot from 2021-07-30 20-56-41

    For values larger than 1000 bps the data should be shown in kbps, but it is not happening as in the highlighted example.

  37. rebroad commented at 7:04 pm on September 14, 2021: contributor

    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.

  38. rebroad force-pushed on Sep 16, 2021
  39. rebroad commented at 5:17 pm on September 16, 2021: contributor

    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.

    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?

  40. shaavan commented at 1:08 pm on September 20, 2021: contributor

    Changes since my last review:

    • The sent data is displayed in kbps when it is greater than 1000bps.
    • bits variable has been changed from uint64_t to float.
    • 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
    Screenshot from 2021-07-30 20-56-41 latest

    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.

  41. Display send/recv in bps instead of totals in the debug window c1a692b69d
  42. rebroad force-pushed on Oct 12, 2021
  43. shaavan commented at 11:44 am on October 14, 2021: contributor

    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?

  44. rebroad commented at 9:01 pm on October 18, 2021: contributor
    @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.
  45. shaavan commented at 12:44 pm on October 19, 2021: contributor

    @rebroad

    have you already created a method for detecting this?

    Unfortunately, not yet. However, I have some ideas on how to do so. Let me try to implement this as soon as possible.

  46. DrahtBot added the label Needs rebase on Dec 10, 2021
  47. DrahtBot commented at 9:47 am on December 10, 2021: contributor

    🐙 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”.

  48. DrahtBot commented at 12:11 pm on March 21, 2022: contributor
    • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
    • Is it no longer relevant? ➡️ Please close.
    • Did the author lose interest or time to work on this? ➡️ Please close it and mark it ‘Up for grabs’ with the label, so that it can be picked up in the future.
  49. hebasto commented at 3:15 pm on April 13, 2022: member
    Closing due to inactivity. Feel free to reopen.
  50. hebasto closed this on Apr 13, 2022

  51. bitcoin-core locked this on Apr 13, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 02:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me