2006-03-04 18:16:49 +00:00
|
|
|
/*
|
|
|
|
htop - CPUMeter.c
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2006-03-04 18:16:49 +00:00
|
|
|
Released under the GNU GPL, see the COPYING file
|
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "CPUMeter.h"
|
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include "CRT.h"
|
2015-01-22 01:27:31 +00:00
|
|
|
#include "Settings.h"
|
|
|
|
#include "Platform.h"
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include <assert.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2006-06-06 20:41:01 +00:00
|
|
|
int CPUMeter_attributes[] = {
|
2020-08-20 04:09:27 +00:00
|
|
|
CPU_NICE, CPU_NORMAL, CPU_SYSTEM, CPU_IRQ, CPU_SOFTIRQ, CPU_STEAL, CPU_GUEST, CPU_IOWAIT
|
2006-06-06 20:41:01 +00:00
|
|
|
};
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2008-03-09 08:58:38 +00:00
|
|
|
static void CPUMeter_init(Meter* this) {
|
2010-08-24 23:20:38 +00:00
|
|
|
int cpu = this->param;
|
|
|
|
if (this->pl->cpuCount > 1) {
|
2006-04-10 20:40:38 +00:00
|
|
|
char caption[10];
|
2020-09-01 11:50:25 +00:00
|
|
|
xSnprintf(caption, sizeof(caption), "%3d", Settings_cpuId(this->pl->settings, cpu - 1));
|
2006-04-10 20:40:38 +00:00
|
|
|
Meter_setCaption(this, caption);
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2006-04-10 20:40:38 +00:00
|
|
|
if (this->param == 0)
|
|
|
|
Meter_setCaption(this, "Avg");
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2016-05-04 05:39:26 +00:00
|
|
|
static void CPUMeter_updateValues(Meter* this, char* buffer, int size) {
|
2010-08-24 23:20:38 +00:00
|
|
|
int cpu = this->param;
|
|
|
|
if (cpu > this->pl->cpuCount) {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, size, "absent");
|
2009-06-02 04:51:23 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-10-23 15:46:21 +00:00
|
|
|
memset(this->values, 0, sizeof(double) * CPU_METER_ITEMCOUNT);
|
2015-01-22 01:27:31 +00:00
|
|
|
double percent = Platform_setCPUValues(this, cpu);
|
2019-08-11 05:19:32 +00:00
|
|
|
if (this->pl->settings->showCPUFrequency) {
|
2019-08-10 04:34:48 +00:00
|
|
|
double cpuFrequency = this->values[CPU_METER_FREQUENCY];
|
2019-08-10 18:37:35 +00:00
|
|
|
char cpuFrequencyBuffer[16];
|
2020-09-07 10:24:32 +00:00
|
|
|
if (isnan(cpuFrequency)) {
|
2019-08-10 18:37:35 +00:00
|
|
|
xSnprintf(cpuFrequencyBuffer, sizeof(cpuFrequencyBuffer), "N/A");
|
|
|
|
} else {
|
2020-09-22 12:50:50 +00:00
|
|
|
xSnprintf(cpuFrequencyBuffer, sizeof(cpuFrequencyBuffer), "%4uMHz", (unsigned)cpuFrequency);
|
2019-08-10 04:34:48 +00:00
|
|
|
}
|
2019-08-10 18:20:21 +00:00
|
|
|
if (this->pl->settings->showCPUUsage) {
|
2019-08-10 18:37:35 +00:00
|
|
|
xSnprintf(buffer, size, "%5.1f%% %s", percent, cpuFrequencyBuffer);
|
2019-08-10 18:20:21 +00:00
|
|
|
} else {
|
2019-08-10 18:37:35 +00:00
|
|
|
xSnprintf(buffer, size, "%s", cpuFrequencyBuffer);
|
2019-08-10 18:20:21 +00:00
|
|
|
}
|
|
|
|
} else if (this->pl->settings->showCPUUsage) {
|
2019-08-10 04:34:48 +00:00
|
|
|
xSnprintf(buffer, size, "%5.1f%%", percent);
|
2019-08-10 18:20:21 +00:00
|
|
|
} else if (size > 0) {
|
|
|
|
buffer[0] = '\0';
|
2019-08-10 04:34:48 +00:00
|
|
|
}
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 08:58:38 +00:00
|
|
|
static void CPUMeter_display(Object* cast, RichString* out) {
|
2006-03-04 18:16:49 +00:00
|
|
|
char buffer[50];
|
|
|
|
Meter* this = (Meter*)cast;
|
2010-11-22 12:40:20 +00:00
|
|
|
RichString_prune(out);
|
2010-08-24 23:20:38 +00:00
|
|
|
if (this->param > this->pl->cpuCount) {
|
2009-06-02 04:51:23 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "absent");
|
|
|
|
return;
|
|
|
|
}
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NORMAL]);
|
2006-03-04 18:16:49 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], ":");
|
|
|
|
RichString_append(out, CRT_colors[CPU_NORMAL], buffer);
|
2015-01-22 01:27:31 +00:00
|
|
|
if (this->pl->settings->detailedCPUTime) {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "sy:");
|
2020-08-20 04:09:27 +00:00
|
|
|
RichString_append(out, CRT_colors[CPU_SYSTEM], buffer);
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "ni:");
|
2014-04-24 16:15:52 +00:00
|
|
|
RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "hi:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_IRQ], buffer);
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_SOFTIRQ]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "si:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_SOFTIRQ], buffer);
|
2020-09-07 10:07:08 +00:00
|
|
|
if (!isnan(this->values[CPU_METER_STEAL])) {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_STEAL]);
|
2013-12-18 02:58:34 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "st:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_STEAL], buffer);
|
|
|
|
}
|
2020-09-07 10:07:08 +00:00
|
|
|
if (!isnan(this->values[CPU_METER_GUEST])) {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_GUEST]);
|
2010-08-24 23:20:38 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "gu:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_GUEST], buffer);
|
|
|
|
}
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IOWAIT]);
|
2013-12-18 02:58:34 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "wa:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_IOWAIT], buffer);
|
2006-10-04 14:21:27 +00:00
|
|
|
} else {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_KERNEL]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "sys:");
|
2020-08-20 04:09:27 +00:00
|
|
|
RichString_append(out, CRT_colors[CPU_SYSTEM], buffer);
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NICE]);
|
2006-10-04 14:21:27 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "low:");
|
2014-04-24 16:15:52 +00:00
|
|
|
RichString_append(out, CRT_colors[CPU_NICE_TEXT], buffer);
|
2020-09-07 10:07:08 +00:00
|
|
|
if (!isnan(this->values[CPU_METER_IRQ])) {
|
2017-07-27 19:07:50 +00:00
|
|
|
xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_IRQ]);
|
2010-08-24 23:20:38 +00:00
|
|
|
RichString_append(out, CRT_colors[METER_TEXT], "vir:");
|
|
|
|
RichString_append(out, CRT_colors[CPU_GUEST], buffer);
|
|
|
|
}
|
2006-10-04 14:21:27 +00:00
|
|
|
}
|
2006-03-04 18:16:49 +00:00
|
|
|
}
|
2006-04-10 20:40:38 +00:00
|
|
|
|
2011-11-18 06:08:56 +00:00
|
|
|
static void AllCPUsMeter_getRange(Meter* this, int* start, int* count) {
|
|
|
|
int cpus = this->pl->cpuCount;
|
2012-12-05 15:12:20 +00:00
|
|
|
switch(Meter_name(this)[0]) {
|
2011-11-18 06:08:56 +00:00
|
|
|
default:
|
|
|
|
case 'A': // All
|
|
|
|
*start = 0;
|
|
|
|
*count = cpus;
|
|
|
|
break;
|
|
|
|
case 'L': // First Half
|
|
|
|
*start = 0;
|
|
|
|
*count = (cpus+1) / 2;
|
|
|
|
break;
|
|
|
|
case 'R': // Second Half
|
|
|
|
*start = (cpus+1) / 2;
|
|
|
|
*count = cpus / 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void CPUMeterCommonInit(Meter *this, int ncol) {
|
2010-08-24 23:20:38 +00:00
|
|
|
int cpus = this->pl->cpuCount;
|
2011-03-31 20:24:59 +00:00
|
|
|
if (!this->drawData)
|
2016-02-02 14:53:02 +00:00
|
|
|
this->drawData = xCalloc(cpus, sizeof(Meter*));
|
2011-03-22 20:37:08 +00:00
|
|
|
Meter** meters = (Meter**) this->drawData;
|
2011-11-18 06:08:56 +00:00
|
|
|
int start, count;
|
|
|
|
AllCPUsMeter_getRange(this, &start, &count);
|
|
|
|
for (int i = 0; i < count; i++) {
|
2011-03-31 20:24:59 +00:00
|
|
|
if (!meters[i])
|
2012-12-05 15:12:20 +00:00
|
|
|
meters[i] = Meter_new(this->pl, start+i+1, (MeterClass*) Class(CPUMeter));
|
|
|
|
Meter_init(meters[i]);
|
2011-03-31 20:24:59 +00:00
|
|
|
}
|
2011-11-18 06:08:56 +00:00
|
|
|
if (this->mode == 0)
|
|
|
|
this->mode = BAR_METERMODE;
|
|
|
|
int h = Meter_modes[this->mode]->h;
|
2020-06-11 21:21:52 +00:00
|
|
|
this->h = h * ((count + ncol - 1)/ ncol);
|
2006-04-10 20:40:38 +00:00
|
|
|
}
|
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) {
|
2011-11-18 06:08:56 +00:00
|
|
|
Meter** meters = (Meter**) this->drawData;
|
2006-05-09 18:35:51 +00:00
|
|
|
this->mode = mode;
|
2011-11-18 06:08:56 +00:00
|
|
|
int h = Meter_modes[mode]->h;
|
|
|
|
int start, count;
|
|
|
|
AllCPUsMeter_getRange(this, &start, &count);
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
Meter_setMode(meters[i], mode);
|
|
|
|
}
|
2020-06-11 21:21:52 +00:00
|
|
|
this->h = h * ((count + ncol - 1)/ ncol);
|
2006-05-09 18:35:51 +00:00
|
|
|
}
|
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void AllCPUsMeter_done(Meter* this) {
|
2011-11-18 06:08:56 +00:00
|
|
|
Meter** meters = (Meter**) this->drawData;
|
|
|
|
int start, count;
|
|
|
|
AllCPUsMeter_getRange(this, &start, &count);
|
2020-09-24 19:17:51 +00:00
|
|
|
for (int i = 0; i < count; i++)
|
|
|
|
Meter_delete((Object*)meters[i]);
|
2011-11-18 06:08:56 +00:00
|
|
|
}
|
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void SingleColCPUsMeter_init(Meter* this) {
|
|
|
|
CPUMeterCommonInit(this, 1);
|
2006-04-10 20:40:38 +00:00
|
|
|
}
|
2008-03-09 08:58:38 +00:00
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void SingleColCPUsMeter_updateMode(Meter* this, int mode) {
|
|
|
|
CPUMeterCommonUpdateMode(this, mode, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void DualColCPUsMeter_init(Meter* this) {
|
|
|
|
CPUMeterCommonInit(this, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void DualColCPUsMeter_updateMode(Meter* this, int mode) {
|
|
|
|
CPUMeterCommonUpdateMode(this, mode, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void QuadColCPUsMeter_init(Meter* this) {
|
|
|
|
CPUMeterCommonInit(this, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void QuadColCPUsMeter_updateMode(Meter* this, int mode) {
|
|
|
|
CPUMeterCommonUpdateMode(this, mode, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CPUMeterCommonDraw(Meter* this, int x, int y, int w, int ncol) {
|
2020-06-11 21:21:52 +00:00
|
|
|
Meter** meters = (Meter**) this->drawData;
|
|
|
|
int start, count;
|
|
|
|
AllCPUsMeter_getRange(this, &start, &count);
|
|
|
|
int colwidth = (w-ncol)/ncol + 1;
|
|
|
|
int diff = (w - (colwidth * ncol));
|
2020-06-12 21:53:05 +00:00
|
|
|
int nrows = (count + ncol - 1) / ncol;
|
2020-06-11 21:21:52 +00:00
|
|
|
for (int i = 0; i < count; i++){
|
2020-06-12 21:53:05 +00:00
|
|
|
int d = (i/nrows) > diff ? diff : (i / nrows) ; // dynamic spacer
|
|
|
|
int xpos = x + ((i / nrows) * colwidth) + d;
|
|
|
|
int ypos = y + ((i % nrows) * meters[0]->h);
|
2020-06-11 21:21:52 +00:00
|
|
|
meters[i]->draw(meters[i], xpos, ypos, colwidth);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-24 19:17:51 +00:00
|
|
|
static void DualColCPUsMeter_draw(Meter* this, int x, int y, int w) {
|
|
|
|
CPUMeterCommonDraw(this, x, y, w, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void QuadColCPUsMeter_draw(Meter* this, int x, int y, int w) {
|
|
|
|
CPUMeterCommonDraw(this, x, y, w, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void SingleColCPUsMeter_draw(Meter* this, int x, int y, int w) {
|
|
|
|
Meter** meters = (Meter**) this->drawData;
|
|
|
|
int start, count;
|
|
|
|
AllCPUsMeter_getRange(this, &start, &count);
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
meters[i]->draw(meters[i], x, y, w);
|
|
|
|
y += meters[i]->h;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass CPUMeter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
2016-05-04 05:39:26 +00:00
|
|
|
.updateValues = CPUMeter_updateValues,
|
2012-12-05 15:12:20 +00:00
|
|
|
.defaultMode = BAR_METERMODE,
|
2015-10-23 15:46:21 +00:00
|
|
|
.maxItems = CPU_METER_ITEMCOUNT,
|
2008-03-09 08:58:38 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2008-03-09 08:58:38 +00:00
|
|
|
.name = "CPU",
|
|
|
|
.uiName = "CPU",
|
|
|
|
.caption = "CPU",
|
|
|
|
.init = CPUMeter_init
|
|
|
|
};
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass AllCPUsMeter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2008-03-09 08:58:38 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2008-03-09 08:58:38 +00:00
|
|
|
.name = "AllCPUs",
|
2011-11-18 06:08:56 +00:00
|
|
|
.uiName = "CPUs (1/1)",
|
2015-02-03 21:31:44 +00:00
|
|
|
.description = "CPUs (1/1): all CPUs",
|
2008-03-09 08:58:38 +00:00
|
|
|
.caption = "CPU",
|
2011-11-18 06:08:56 +00:00
|
|
|
.draw = SingleColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = SingleColCPUsMeter_init,
|
|
|
|
.updateMode = SingleColCPUsMeter_updateMode,
|
2008-03-09 08:58:38 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
2011-11-18 06:08:56 +00:00
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass AllCPUs2Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2011-11-18 06:08:56 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2011-11-18 06:08:56 +00:00
|
|
|
.name = "AllCPUs2",
|
|
|
|
.uiName = "CPUs (1&2/2)",
|
2015-02-03 21:31:44 +00:00
|
|
|
.description = "CPUs (1&2/2): all CPUs in 2 shorter columns",
|
2011-11-18 06:08:56 +00:00
|
|
|
.caption = "CPU",
|
|
|
|
.draw = DualColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = DualColCPUsMeter_init,
|
|
|
|
.updateMode = DualColCPUsMeter_updateMode,
|
2011-11-18 06:08:56 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass LeftCPUsMeter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2011-11-18 06:08:56 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2011-11-18 06:08:56 +00:00
|
|
|
.name = "LeftCPUs",
|
|
|
|
.uiName = "CPUs (1/2)",
|
2015-02-03 21:31:44 +00:00
|
|
|
.description = "CPUs (1/2): first half of list",
|
2011-11-18 06:08:56 +00:00
|
|
|
.caption = "CPU",
|
|
|
|
.draw = SingleColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = SingleColCPUsMeter_init,
|
|
|
|
.updateMode = SingleColCPUsMeter_updateMode,
|
2011-11-18 06:08:56 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass RightCPUsMeter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2011-11-18 06:08:56 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2011-11-18 06:08:56 +00:00
|
|
|
.name = "RightCPUs",
|
|
|
|
.uiName = "CPUs (2/2)",
|
2015-02-03 21:31:44 +00:00
|
|
|
.description = "CPUs (2/2): second half of list",
|
2011-11-18 06:08:56 +00:00
|
|
|
.caption = "CPU",
|
|
|
|
.draw = SingleColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = SingleColCPUsMeter_init,
|
|
|
|
.updateMode = SingleColCPUsMeter_updateMode,
|
2011-11-18 06:08:56 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass LeftCPUs2Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2011-11-18 06:08:56 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2011-11-18 06:08:56 +00:00
|
|
|
.name = "LeftCPUs2",
|
|
|
|
.uiName = "CPUs (1&2/4)",
|
2016-03-11 02:54:34 +00:00
|
|
|
.description = "CPUs (1&2/4): first half in 2 shorter columns",
|
2011-11-18 06:08:56 +00:00
|
|
|
.caption = "CPU",
|
|
|
|
.draw = DualColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = DualColCPUsMeter_init,
|
|
|
|
.updateMode = DualColCPUsMeter_updateMode,
|
2011-11-18 06:08:56 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
2012-12-05 15:12:20 +00:00
|
|
|
MeterClass RightCPUs2Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
2011-11-18 06:08:56 +00:00
|
|
|
.total = 100.0,
|
2019-10-31 16:39:12 +00:00
|
|
|
.attributes = CPUMeter_attributes,
|
2011-11-18 06:08:56 +00:00
|
|
|
.name = "RightCPUs2",
|
|
|
|
.uiName = "CPUs (3&4/4)",
|
2015-02-03 21:31:44 +00:00
|
|
|
.description = "CPUs (3&4/4): second half in 2 shorter columns",
|
2011-11-18 06:08:56 +00:00
|
|
|
.caption = "CPU",
|
|
|
|
.draw = DualColCPUsMeter_draw,
|
2020-09-24 19:17:51 +00:00
|
|
|
.init = DualColCPUsMeter_init,
|
|
|
|
.updateMode = DualColCPUsMeter_updateMode,
|
2011-11-18 06:08:56 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
2020-06-11 21:21:52 +00:00
|
|
|
MeterClass AllCPUs4Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
|
|
|
.total = 100.0,
|
|
|
|
.attributes = CPUMeter_attributes,
|
|
|
|
.name = "AllCPUs4",
|
|
|
|
.uiName = "CPUs (1&2&3&4/4)",
|
|
|
|
.description = "CPUs (1&2&3&4/4): all CPUs in 4 shorter columns",
|
|
|
|
.caption = "CPU",
|
2020-09-24 19:17:51 +00:00
|
|
|
.draw = QuadColCPUsMeter_draw,
|
|
|
|
.init = QuadColCPUsMeter_init,
|
|
|
|
.updateMode = QuadColCPUsMeter_updateMode,
|
2020-06-11 21:21:52 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
|
|
|
MeterClass LeftCPUs4Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
|
|
|
.total = 100.0,
|
|
|
|
.attributes = CPUMeter_attributes,
|
|
|
|
.name = "LeftCPUs4",
|
|
|
|
.uiName = "CPUs (1-4/8)",
|
|
|
|
.description = "CPUs (1-4/8): first half in 4 shorter columns",
|
|
|
|
.caption = "CPU",
|
2020-09-24 19:17:51 +00:00
|
|
|
.draw = QuadColCPUsMeter_draw,
|
|
|
|
.init = QuadColCPUsMeter_init,
|
|
|
|
.updateMode = QuadColCPUsMeter_updateMode,
|
2020-06-11 21:21:52 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|
|
|
|
|
|
|
|
MeterClass RightCPUs4Meter_class = {
|
|
|
|
.super = {
|
|
|
|
.extends = Class(Meter),
|
|
|
|
.delete = Meter_delete,
|
|
|
|
.display = CPUMeter_display
|
|
|
|
},
|
|
|
|
.defaultMode = CUSTOM_METERMODE,
|
|
|
|
.total = 100.0,
|
|
|
|
.attributes = CPUMeter_attributes,
|
|
|
|
.name = "RightCPUs4",
|
|
|
|
.uiName = "CPUs (5-8/8)",
|
|
|
|
.description = "CPUs (5-8/8): second half in 4 shorter columns",
|
|
|
|
.caption = "CPU",
|
2020-09-24 19:17:51 +00:00
|
|
|
.draw = QuadColCPUsMeter_draw,
|
|
|
|
.init = QuadColCPUsMeter_init,
|
|
|
|
.updateMode = QuadColCPUsMeter_updateMode,
|
2020-06-11 21:21:52 +00:00
|
|
|
.done = AllCPUsMeter_done
|
|
|
|
};
|