CPUMeter: add octuple-column CPU meters.

This is a straightforward extension of the existing multi-column CPU meter
code, which now allows for up CPU meters to be displayed in up to 16 columns.

This also adds the meter declarations to all the platform-specific code.
This commit is contained in:
multi 2020-09-24 20:56:40 +01:00 committed by cgzones
parent 491bf98b90
commit 9ee72568dc
9 changed files with 96 additions and 0 deletions

View File

@ -192,6 +192,14 @@ static void QuadColCPUsMeter_updateMode(Meter* this, int mode) {
CPUMeterCommonUpdateMode(this, mode, 4); CPUMeterCommonUpdateMode(this, mode, 4);
} }
static void OctoColCPUsMeter_init(Meter* this) {
CPUMeterCommonInit(this, 8);
}
static void OctoColCPUsMeter_updateMode(Meter* this, int mode) {
CPUMeterCommonUpdateMode(this, mode, 8);
}
static void CPUMeterCommonDraw(Meter* this, int x, int y, int w, int ncol) { static void CPUMeterCommonDraw(Meter* this, int x, int y, int w, int ncol) {
Meter** meters = (Meter**) this->drawData; Meter** meters = (Meter**) this->drawData;
int start, count; int start, count;
@ -215,6 +223,10 @@ static void QuadColCPUsMeter_draw(Meter* this, int x, int y, int w) {
CPUMeterCommonDraw(this, x, y, w, 4); CPUMeterCommonDraw(this, x, y, w, 4);
} }
static void OctoColCPUsMeter_draw(Meter* this, int x, int y, int w) {
CPUMeterCommonDraw(this, x, y, w, 8);
}
static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) { static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) {
Meter** meters = (Meter**) this->drawData; Meter** meters = (Meter**) this->drawData;
@ -414,3 +426,60 @@ MeterClass RightCPUs4Meter_class = {
.updateMode = QuadColCPUsMeter_updateMode, .updateMode = QuadColCPUsMeter_updateMode,
.done = AllCPUsMeter_done .done = AllCPUsMeter_done
}; };
MeterClass AllCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
.display = CPUMeter_display
},
.defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "AllCPUs8",
.uiName = "CPUs (1-8/8)",
.description = "CPUs (1-8/8): all CPUs in 8 shorter columns",
.caption = "CPU",
.draw = OctoColCPUsMeter_draw,
.init = OctoColCPUsMeter_init,
.updateMode = OctoColCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
MeterClass LeftCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
.display = CPUMeter_display
},
.defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "LeftCPUs8",
.uiName = "CPUs (1-8/16)",
.description = "CPUs (1-8/16): first half in 8 shorter columns",
.caption = "CPU",
.draw = OctoColCPUsMeter_draw,
.init = OctoColCPUsMeter_init,
.updateMode = OctoColCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};
MeterClass RightCPUs8Meter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete,
.display = CPUMeter_display
},
.defaultMode = CUSTOM_METERMODE,
.total = 100.0,
.attributes = CPUMeter_attributes,
.name = "RightCPUs8",
.uiName = "CPUs (9-16/16)",
.description = "CPUs (9-16/16): second half in 8 shorter columns",
.caption = "CPU",
.draw = OctoColCPUsMeter_draw,
.init = OctoColCPUsMeter_init,
.updateMode = OctoColCPUsMeter_updateMode,
.done = AllCPUsMeter_done
};

View File

@ -44,4 +44,10 @@ extern MeterClass LeftCPUs4Meter_class;
extern MeterClass RightCPUs4Meter_class; extern MeterClass RightCPUs4Meter_class;
extern MeterClass AllCPUs8Meter_class;
extern MeterClass LeftCPUs8Meter_class;
extern MeterClass RightCPUs8Meter_class;
#endif #endif

View File

@ -106,12 +106,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&ZfsArcMeter_class, &ZfsArcMeter_class,
&ZfsCompressedArcMeter_class, &ZfsCompressedArcMeter_class,
&BlankMeter_class, &BlankMeter_class,

View File

@ -89,12 +89,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class, &BlankMeter_class,
NULL NULL
}; };

View File

@ -90,12 +90,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class, &BlankMeter_class,
&ZfsArcMeter_class, &ZfsArcMeter_class,
&ZfsCompressedArcMeter_class, &ZfsCompressedArcMeter_class,

View File

@ -114,12 +114,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class, &BlankMeter_class,
&PressureStallCPUSomeMeter_class, &PressureStallCPUSomeMeter_class,
&PressureStallIOSomeMeter_class, &PressureStallIOSomeMeter_class,

View File

@ -102,12 +102,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class, &BlankMeter_class,
NULL NULL
}; };

View File

@ -99,12 +99,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&ZfsArcMeter_class, &ZfsArcMeter_class,
&ZfsCompressedArcMeter_class, &ZfsCompressedArcMeter_class,
&BlankMeter_class, &BlankMeter_class,

View File

@ -70,12 +70,15 @@ MeterClass* Platform_meterTypes[] = {
&AllCPUsMeter_class, &AllCPUsMeter_class,
&AllCPUs2Meter_class, &AllCPUs2Meter_class,
&AllCPUs4Meter_class, &AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class, &LeftCPUsMeter_class,
&RightCPUsMeter_class, &RightCPUsMeter_class,
&LeftCPUs2Meter_class, &LeftCPUs2Meter_class,
&RightCPUs2Meter_class, &RightCPUs2Meter_class,
&LeftCPUs4Meter_class, &LeftCPUs4Meter_class,
&RightCPUs4Meter_class, &RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class, &BlankMeter_class,
NULL NULL
}; };