mirror of https://github.com/xzeldon/htop.git
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:
parent
491bf98b90
commit
9ee72568dc
69
CPUMeter.c
69
CPUMeter.c
|
@ -192,6 +192,14 @@ static void QuadColCPUsMeter_updateMode(Meter* this, int mode) {
|
|||
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) {
|
||||
Meter** meters = (Meter**) this->drawData;
|
||||
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);
|
||||
}
|
||||
|
||||
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) {
|
||||
Meter** meters = (Meter**) this->drawData;
|
||||
|
@ -414,3 +426,60 @@ MeterClass RightCPUs4Meter_class = {
|
|||
.updateMode = QuadColCPUsMeter_updateMode,
|
||||
.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
|
||||
};
|
||||
|
|
|
@ -44,4 +44,10 @@ extern MeterClass LeftCPUs4Meter_class;
|
|||
|
||||
extern MeterClass RightCPUs4Meter_class;
|
||||
|
||||
extern MeterClass AllCPUs8Meter_class;
|
||||
|
||||
extern MeterClass LeftCPUs8Meter_class;
|
||||
|
||||
extern MeterClass RightCPUs8Meter_class;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -106,12 +106,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&ZfsArcMeter_class,
|
||||
&ZfsCompressedArcMeter_class,
|
||||
&BlankMeter_class,
|
||||
|
|
|
@ -89,12 +89,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&BlankMeter_class,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -90,12 +90,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&BlankMeter_class,
|
||||
&ZfsArcMeter_class,
|
||||
&ZfsCompressedArcMeter_class,
|
||||
|
|
|
@ -114,12 +114,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&BlankMeter_class,
|
||||
&PressureStallCPUSomeMeter_class,
|
||||
&PressureStallIOSomeMeter_class,
|
||||
|
|
|
@ -102,12 +102,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&BlankMeter_class,
|
||||
NULL
|
||||
};
|
||||
|
|
|
@ -99,12 +99,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&ZfsArcMeter_class,
|
||||
&ZfsCompressedArcMeter_class,
|
||||
&BlankMeter_class,
|
||||
|
|
|
@ -70,12 +70,15 @@ MeterClass* Platform_meterTypes[] = {
|
|||
&AllCPUsMeter_class,
|
||||
&AllCPUs2Meter_class,
|
||||
&AllCPUs4Meter_class,
|
||||
&AllCPUs8Meter_class,
|
||||
&LeftCPUsMeter_class,
|
||||
&RightCPUsMeter_class,
|
||||
&LeftCPUs2Meter_class,
|
||||
&RightCPUs2Meter_class,
|
||||
&LeftCPUs4Meter_class,
|
||||
&RightCPUs4Meter_class,
|
||||
&LeftCPUs8Meter_class,
|
||||
&RightCPUs8Meter_class,
|
||||
&BlankMeter_class,
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue