summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wong <mark@2ndQuadrant.com>2020-04-05 00:55:57 +0000
committerMark Wong <mark@2ndQuadrant.com>2020-04-05 00:55:57 +0000
commite49e905909363990fe49414ed687d21aa5c3901c (patch)
tree72405f92edce28844aaa744d16f042789db2be93
parentda92e3ab48912565246d7c10388b4a98b704ef33 (diff)
Fix coloring of CPU states
The update and initialization functions were not coloring the same parts of the text.
-rw-r--r--display.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/display.c b/display.c
index 970e77c..20721f4 100644
--- a/display.c
+++ b/display.c
@@ -1037,10 +1037,11 @@ i_cpustates(int64_t * states)
/* if percentage is >= 1000, print it as 100% */
display_fmt(x_cpustates + *colp, y_cpustates,
color, 0,
- (value >= 1000 ? "%4.0f%% %s%s" : "%4.1f%% %s%s"),
+ (value >= 1000 ? "%4.0f%% %s" : "%4.1f%% %s"),
((float) value) / 10.,
- thisname,
- *names != NULL ? ", " : "");
+ thisname);
+ if (*names != NULL)
+ display_write(-1, -1, 0, 0, ",");
}
/* increment */
@@ -1087,9 +1088,13 @@ u_cpustates(int64_t * states)
#endif
/* if percentage is >= 1000, print it as 100% */
- display_fmt(x_cpustates + *colp, y_cpustates, color, 0,
- (value >= 1000 ? "%4.0f" : "%4.1f"),
- ((double) value) / 10.);
+ display_fmt(x_cpustates + *colp, y_cpustates,
+ color, 0,
+ (value >= 1000 ? "%4.0f%% %s" : "%4.1f%% %s"),
+ ((float) value) / 10.,
+ thisname);
+ if (*names != NULL)
+ display_write(-1, -1, 0, 0, ",");
/* remember it for next time */
*lp = value;