-
-
Notifications
You must be signed in to change notification settings - Fork 531
Split DiskIOMeter into disk IO time and rate sub-meters #1763
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
base: main
Are you sure you want to change the base?
Conversation
68ccd1f to
a718df6
Compare
1b33b9b to
8b5bf63
Compare
26ea738 to
eecc641
Compare
|
What's currently still open for this PR to become ready? |
I originally made this PR as a "proof of concept" and to grab early comments about the meters' look and functions.
|
The new function is named DiskIOUpdateCache(). Allows code reuse. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
No changes in behavior. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
|
Just did a quick check with the design and I think the combined meter should show IO rates left, IO Time used on the right. Else you get quite a big gap with just the percentage shown in text mode. |
Makes sense. Perhaps another good reason is that people might look at the I/O rate graph more often than the time/utilisation percentage. (Besides, the I/O rate graph can support two channels while the percentage graph cannot.) |
eecc641 to
1ec2f55
Compare
DiskIOMeter.c
Outdated
| }; | ||
|
|
||
| static const int DiskIOTimeMeter_attributes[] = { | ||
| METER_VALUE_NOTICE |
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.
| METER_VALUE_NOTICE | |
| METER_VALUE_NOTICE, |
| assert(data->diskIORateMeter->draw); | ||
| data->diskIORateMeter->draw(data->diskIORateMeter, x, y, colwidth); | ||
| assert(data->diskIOTimeMeter->draw); | ||
| data->diskIOTimeMeter->draw(data->diskIOTimeMeter, x + colwidth + diff, y, colwidth); |
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.
While initializing or stale, this looks kinda strange (in text mode).
The IO Time meter itself could benefit from actually labeling the value it shows in text mode.
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.
What do you mean when you say it looks strange?
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.
Basically you have like:
Dsk: Stale ... Dsk: Stale ...
where you somewhat break the illusion of this being one meter …
I think:
Dsk: Stale ...
should suffice.
Similar, in the text mode, having values from both meters right next to each other
Dsk: read: 42.23 KiB/s, write: 666.69 MiB/s, usage: 1337%
compare to current:
Dsk: read: 42.23 KiB/s, write: 666.69 MiB/s Dsk: 1337%
would be somewhat more intuitive.
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.
That means merging the two strings in the Text meter display. It's a bit out of scope of my PR, but I know it's a good feature. I'm not sure how to make it, though.
DiskIOMeter.c
Outdated
| DiskIOMeterData* data = this->meterData; | ||
|
|
||
| if (!data) { | ||
| data = this->meterData = xCalloc(1, sizeof(DiskIOMeterData)); | ||
| } |
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.
Maybe avoid this double assignment?
| DiskIOMeterData* data = this->meterData; | |
| if (!data) { | |
| data = this->meterData = xCalloc(1, sizeof(DiskIOMeterData)); | |
| } | |
| if (!this->meterData) { | |
| this->meterData = xCalloc(1, sizeof(DiskIOMeterData)); | |
| } | |
| DiskIOMeterData* data = this->meterData; |
| assert(data->diskIORateMeter->draw); | ||
| data->diskIORateMeter->draw(data->diskIORateMeter, x, y, colwidth); | ||
| assert(data->diskIOTimeMeter->draw); | ||
| data->diskIOTimeMeter->draw(data->diskIOTimeMeter, x + colwidth + diff, y, colwidth); |
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's Meter_drawFn that could be used here.
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.
Meter_drawFn refers to the (custom) draw function associated with the meter class, not the meter mode. So no, they are not the same.
The two meters are split from DiskIOMeter and they allow separate display of disk read & write rates and the busy time percentage, including drawing the data as separate bars and graphs. The old DiskIOMeter is kept for backward compatibility. It will be reworked in the next commit. Note that DiskIORateMeter and DiskIOTimeMeter have different 'isPercentChart' values. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
The new meter is a combined display of DiskIORate and DiskIOTime. The mechanism is similar to MemorySwapMeter. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
1ec2f55 to
a5d1e6d
Compare
|
@BenBE On the topic of avoiding double assignment in code style, I found there are three other files that had this "double assignment" syntax when initializing data. Not sure if you want these to be changed as well, but I'm reluctant to file a new PR for this minor style change: --- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -241,9 +241,10 @@ static void CPUMeterCommonInit(Meter* this) {
CPUMeterData* data = this->meterData;
if (!data) {
- data = this->meterData = xMalloc(sizeof(CPUMeterData));
+ data = xMalloc(sizeof(CPUMeterData));
data->cpus = this->host->existingCPUs;
data->meters = count ? xCalloc(count, sizeof(Meter*)) : NULL;
+ this->meterData = data;
}
Meter** meters = data->meters;
--- a/Machine.c
+++ b/Machine.c
@@ -79,9 +79,11 @@ void Machine_populateTablesFromSettings(Machine* this, Settings* settings, Table
for (size_t i = 0; i < settings->nScreens; i++) {
ScreenSettings* ss = settings->screens[i];
+
+ if (!ss->table)
+ ss->table = processTable;
+
Table* table = ss->table;
- if (!table)
- table = ss->table = processTable;
if (i == 0)
this->activeTable = table;
--- a/MemorySwapMeter.c
+++ b/MemorySwapMeter.c
@@ -47,11 +47,10 @@ static void MemorySwapMeter_draw(Meter* this, int x, int y, int w) {
}
static void MemorySwapMeter_init(Meter* this) {
- MemorySwapMeterData* data = this->meterData;
+ if (!this->meterData)
+ this->meterData = xCalloc(1, sizeof(MemorySwapMeterData));
- if (!data) {
- data = this->meterData = xCalloc(1, sizeof(MemorySwapMeterData));
- }
+ MemorySwapMeterData* data = this->meterData;
if (!data->memoryMeter)
data->memoryMeter = Meter_new(this->host, 0, (const MeterClass*) Class(MemoryMeter)); |
Based on a patch in #1763 (comment) Co-authored-by: Kang-Che Sung <explorer09@gmail.com>
|
@Explorer09 Patch applied on main with slight modifications. |
Split the
DiskIOMeterinto two,DiskIOTimeMeterandDiskIORateMeter, showing the time and the rate separately.The name
DiskIOMeteris retained but now shows the combined view of time and rate, similar toMemorySwapMeter.This PR depends on #1721, which introduces an
isPercentChartproperty to meters. Note thisisPercentChartproperty is different between sub-meters, and it could explain the reason why the split is worth it.