mirror of https://github.com/xzeldon/htop.git
CPUMeter: show if a CPU is offline in text mode
Related to #729 as the text mode displays all zero values for offline CPUs.
This commit is contained in:
parent
671282d309
commit
ba5ef1ac8b
|
@ -116,9 +116,15 @@ static void CPUMeter_display(const Object* cast, RichString* out) {
|
||||||
const Meter* this = (const Meter*)cast;
|
const Meter* this = (const Meter*)cast;
|
||||||
|
|
||||||
if (this->param > this->pl->existingCPUs) {
|
if (this->param > this->pl->existingCPUs) {
|
||||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], "absent");
|
RichString_appendAscii(out, CRT_colors[METER_SHADOW], " absent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->curItems == 0) {
|
||||||
|
RichString_appendAscii(out, CRT_colors[METER_SHADOW], " offline");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
len = xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NORMAL]);
|
len = xSnprintf(buffer, sizeof(buffer), "%5.1f%% ", this->values[CPU_METER_NORMAL]);
|
||||||
RichString_appendAscii(out, CRT_colors[METER_TEXT], ":");
|
RichString_appendAscii(out, CRT_colors[METER_TEXT], ":");
|
||||||
RichString_appendnAscii(out, CRT_colors[CPU_NORMAL], buffer, len);
|
RichString_appendnAscii(out, CRT_colors[CPU_NORMAL], buffer, len);
|
||||||
|
|
Loading…
Reference in New Issue