-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
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.
|
|
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
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 <[email protected]>
|
@Explorer09 Patch applied on main with slight modifications. |
a5d1e6d to
2bf6fe0
Compare
2bf6fe0 to
7e6794e
Compare
|
|
||
| char buffer[16]; | ||
|
|
||
| int color = cached_utilisation_diff > 40.0 ? METER_VALUE_NOTICE : METER_VALUE; |
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.
Where does the 40% come from?
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.
7e6794e to
a2ac79f
Compare
The new function is named DiskIOUpdateCache(). Allow code reuse. Signed-off-by: Kang-Che Sung <[email protected]>
No changes in behavior. Signed-off-by: Kang-Che Sung <[email protected]>
a8cb854 to
1509583
Compare
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 <[email protected]>
The new meter is a combined display of DiskIORate and DiskIOTime. The combination works similarly to MemorySwapMeter. Signed-off-by: Kang-Che Sung <[email protected]>
1509583 to
bb7317c
Compare
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(merged), which introduces anisPercentChartproperty to meters. Note thisisPercentChartproperty is different between sub-meters, and it could explain the reason why the split is worth it.