Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Explorer09
Copy link
Contributor

@Explorer09 Explorer09 commented Aug 31, 2025

Split the DiskIOMeter into two, DiskIOTimeMeter and DiskIORateMeter, showing the time and the rate separately.

The name DiskIOMeter is retained but now shows the combined view of time and rate, similar to MemorySwapMeter.

This PR depends on #1721, which introduces an isPercentChart property to meters. Note this isPercentChart property is different between sub-meters, and it could explain the reason why the split is worth it.

This property distinguishes meters that have a (relatively) fixed
"total" value and meters that do not have a definite maximum value.
The former meters would be drawn as a "100% stacked bar" or "graph", and
the latter could have their "total" values updated automatically in bar
meter mode.

This commit is a prerequisite for the feature "Graph meter dynamic
scaling and percent graph drawing".

Signed-off-by: Kang-Che Sung <[email protected]>
If "isPercentChart" of a meter is false, update its "total" value
automatically in the bar meter mode. The "total" value is capped to
DBL_MAX in order to ensure the division never produces NaN.

The newly introduced Meter_computeSum() function will be reused by the
feature "Graph meter dynamic scaling and percent graph drawing".

Signed-off-by: Kang-Che Sung <[email protected]>
Implement dynamic scaling for Graph meter mode, and separate it from
"100% graph" drawing. This is controlled by the "isPercentChart"
property of a MeterClass.

If "isPercentChart" is true, the meter would be drawn as a
"100% graph". Graph meters now expect the "total" value may change, and
the newly changed "total" value no longer affects the percent graph
drawings of earlier meter values.

If "isPercentChart" is false, the meter would be drawn with a dynamic
scale.

Signed-off-by: Kang-Che Sung <[email protected]>
The meter now has a dynamic scale, and so the "total" value can be
updated automatically by the bar meter drawing code.

The initial "total" value for LoadAverageMeter is now always the number
of active CPUs (processor threads).

Signed-off-by: Kang-Che Sung <[email protected]>
The bar meter drawing code can now update the "total" value
automatically.

Signed-off-by: Kang-Che Sung <[email protected]>
The bar meter drawing code can now update the "total" value
automatically.

Signed-off-by: Kang-Che Sung <[email protected]>
The new function is named DiskIOUpdateCache().
Allows code reuse.
No change in behavior
@Explorer09 Explorer09 force-pushed the disk-io-meter-split branch from b0d8675 to 68ccd1f Compare October 4, 2025 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Completely new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants