diff options
author | Mark Wong <mark@2ndQuadrant.com> | 2020-04-05 00:55:57 +0000 |
---|---|---|
committer | Mark Wong <mark@2ndQuadrant.com> | 2020-04-05 00:55:57 +0000 |
commit | e49e905909363990fe49414ed687d21aa5c3901c (patch) | |
tree | 72405f92edce28844aaa744d16f042789db2be93 | |
parent | da92e3ab48912565246d7c10388b4a98b704ef33 (diff) |
Fix coloring of CPU states
The update and initialization functions were not coloring the same parts
of the text.
-rw-r--r-- | display.c | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -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; |