Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions zpool-iostat-viz
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,19 @@ def render_stats(window, transform, should_show_differential, pool, filename=Non
elif in_key == ord('d'):
should_show_differential = not should_show_differential
elif in_key == ord('m'):
stats = None
stats_history = []
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of discarding recent history, I'd prefer it if stats and stats_history were unaffected by views and transforming functions were only used to interpret the raw data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you do not want to clear the stats_history array, I'd assume that you need two arrays, one for the device centric view, the other for the measurements centric view.
Always applying both transforms and just selecting one of 2 stats and stats_history arrays for display would be a simple change, but my main intend was to provide a fix for the issue that resulted from the addition of the "m" command.
If you provide 2 sets of arrays and put the restriction of "current" to the allowed index range at the start of the loop, then resetting of current to 0 could also be dropped.
I'll update the FreeBSD port to whatever you decide to implement.

current = 0
load_time = None
if transform == stats_as_device_centric:
transform = stats_as_measurement_centric
else:
transform = stats_as_device_centric
elif in_key == ord('q') or in_key == ord('x') or in_key == 27:
return
current += len(stats)
current %= len(stats)
if stats:
current += len(stats)
current %= len(stats)


def main(window, should_show_differential, pool, filename, views):
Expand Down