Skip to content

Conversation

RandyMcMillan
Copy link
Contributor

The Network Graph is updated to scale based on the time interval selected by the QSlider.
The graph now displays a sample history that is retained when the QSlider value is changed.
Fixes issue #532

@RandyMcMillan
Copy link
Contributor Author

This is a short screen cast of the functionality.

Screen.Recording.2022-01-27.at.1.47.21.AM.mov

@RandyMcMillan
Copy link
Contributor Author

Here it is retaining 5 1/2 hours of samples - still snappy.

Screen.Recording.2022-01-27.at.8.42.34.AM.mov

@RandyMcMillan
Copy link
Contributor Author

Original issue description #7481 (2016)

bitcoin/bitcoin#7481

@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 27, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK jonatack, w0xlt

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #524 (Replace int with std::chrono in for the timer->setInterval() argument by shaavan)
  • #492 (Show ToolTip on Network Traffic graph by rebroad)
  • #484 (Don't clear traffic graph when changing interval by rebroad)
  • #473 (Enable a non-linear network traffic option (click to toggle between linear and non-linear) by rebroad)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@RandyMcMillan
Copy link
Contributor Author

RandyMcMillan commented Jan 28, 2022

Commit 4292212
takes the relevant samples from the global sample list to determine tmax - which is used to calculate the y axis'.

20220128021252941.mp4

@RandyMcMillan RandyMcMillan force-pushed the 1643263956-network-graph-issue-532 branch from 86120e9 to fba8ef0 Compare January 28, 2022 14:08
@RandyMcMillan
Copy link
Contributor Author

Implemented PR #473 Log Scale Toggle

20220128140238975.mp4

@rsafier
Copy link

rsafier commented Jan 29, 2022

tested it out and seemed to behave as expected.

@jonatack
Copy link
Member

jonatack commented Jan 29, 2022

Concept ACK, thanks for tackling this. Will review/test shortly. Edit: initial testing looks good.

@RandyMcMillan
Copy link
Contributor Author

RandyMcMillan commented Jan 29, 2022

commit 83e521c - attaches the scale toggle to a mouse double click event opposed to a single click event.
Toggling the scale is more intentional this way - plus it makes a single click event available for something more useful.

@RandyMcMillan
Copy link
Contributor Author

In some of the previous screen shots - the colors look muddy - commit 8eeb1f1 adjusts the visual output to avoid the way the colors were mixing and creating a muddy effect.

commit-8eeb1f1.mp4

@RandyMcMillan
Copy link
Contributor Author

RandyMcMillan commented Jan 29, 2022

I have more ideas related to the network graph - I will post a different PR based on this PR - with some other ideas...

Screen Shot 2022-01-29 at 2 10 01 PM (2)

@w0xlt
Copy link
Contributor

w0xlt commented Jan 30, 2022

Concept ACK

void TrafficGraphWidget::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.fillRect(rect(), Qt::black);

if(fMax <= 0.0f) return;

QColor axisCol(Qt::gray);
QColor axisCol(QColor(78,78,78,255));
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't check to see if there was a Qt defined dark gray - It is ideal to let the samples stand out above the scale lines - we can tweak this. Note: there is plenty of room unused in the side panel - I have some code laying around to define user preferred color palettes - could be a useful feature for usability/accessibility.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A thought was to implement Solarized Light/Dark color palettes as user options - I am a fan - and plenty of research has gone into these color schemes.

@@ -135,32 +161,35 @@ void TrafficGraphWidget::updateRates()
nLastBytesIn = bytesIn;
nLastBytesOut = bytesOut;

while(vSamplesIn.size() > DESIRED_SAMPLES) {
while(vSamplesIn.size() > FLT_MAX - 1) {
Copy link
Contributor

@rebroad rebroad Feb 1, 2022

Choose a reason for hiding this comment

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

how much memory does this need?

concept ACK implementation NACK - it's unnecessary to store so many sample points, given the granulatory can be decreased as the times period gets longer. Resampling as the data gets older is a better way (as it avoids wasting memory on data that will never be displayed).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree - I have been thinking about how to do this. Maybe pruning the list at larger intervals - keeping samples that are above a moving average. Open to suggestions on implementation. :)

Thanks for looking at this!

Copy link
Contributor Author

@RandyMcMillan RandyMcMillan Feb 1, 2022

Choose a reason for hiding this comment

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

We can chunk the end of the list at DESIRED_SAMPLES intervals - calculate the moving average - pruning samples that fall below it.

The debugwindow - network graph hides ui elements
btnClearTrafficGraph, lblGraphRange, sldGraphRange
when at minimumHeight, it also hides the groupBox
at minimumWidth - this maximizes the dimensions of
the traffic graph in these small dimensions.
@RandyMcMillan RandyMcMillan force-pushed the 1643263956-network-graph-issue-532 branch from 0902db8 to 874b2d8 Compare February 2, 2022 21:05
@RandyMcMillan
Copy link
Contributor Author

RandyMcMillan commented Feb 2, 2022

rebase to fix Centos CI issue
874b2d8 - add hide panel logic which collapses window to a "desktop widget"
bb5b4cc - changed DESIRED_SAMPLES to 300 - reducing overall memory usage - going to try some other ideas to minimize memory usage. (interim adjustment based on @rebroad's comment)
c0f46d2 - the linear scale is the default presentation - this is familiar to users - a follow up PR should include a note on adding double click log scale to release notes.

commit 874b2d8 screen cast:

20220202160130623_trimmed.mp4

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 4, 2022

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

@rebroad
Copy link
Contributor

rebroad commented Feb 7, 2022

I've been working on this, and I have a pull request almost ready to make - storing 600 samples per time range, and 14 ranges in total (from 5 minutes to 28 days), so 8400 samples in total.

video_2022-02-08_13-12-48.mp4

Or, smoother scaling of the horizontal also, or too gimicky? (below)

video_2022-02-16_22-05-15.mp4

The plan is to add notches on the slider for these main samples, but then allow the slider to stop in a few places in between, e.g. for 15m, 45m or 1h30m, 4h30m, 2days, etc.. the resolution will be slightly lower (as it's not sampled at these ranges), but it's probably nice to have these extra options.

@RandyMcMillan
Copy link
Contributor Author

@rebroad - awesome!

@hebasto hebasto added the UX All about "how to get things done" label Feb 9, 2022
@hebasto hebasto changed the title gui: scale network graph based on time interval Scale network graph based on time interval Feb 9, 2022
@RandyMcMillan RandyMcMillan marked this pull request as draft February 17, 2022 15:10
@RandyMcMillan
Copy link
Contributor Author

@rebroad - I am curious if your memory managment is ready...

I am happy to merge it into this PR...

@hebasto
Copy link
Member

hebasto commented Jul 19, 2022

What is the status of this PR?

@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?
  • 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.

@rebroad
Copy link
Contributor

rebroad commented Dec 10, 2022

What is the status of this PR?

I'm currently rebasing it. Should update soon.

@DrahtBot
Copy link
Contributor

There hasn't been much activity lately and the patch still needs rebase. What is the status here?

  • 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.

@hebasto
Copy link
Member

hebasto commented Mar 10, 2023

How do I label it as up for grabs?

Done.

@fanquake fanquake closed this Mar 10, 2023
@bitcoin-core bitcoin-core locked and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs rebase Up for grabs UX All about "how to get things done"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants