From ded9c5d36332401bb8d5e33b6f72de188a42560d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 8 Dec 2020 15:55:26 +0100 Subject: PSI Meter: use constant width and only print ten-duration as bar --- linux/PressureStallMeter.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'linux/PressureStallMeter.c') diff --git a/linux/PressureStallMeter.c b/linux/PressureStallMeter.c index 91ac562b..7486968f 100644 --- a/linux/PressureStallMeter.c +++ b/linux/PressureStallMeter.c @@ -43,17 +43,21 @@ static void PressureStallMeter_updateValues(Meter* this, char* buffer, size_t le } Platform_getPressureStall(file, some, &this->values[0], &this->values[1], &this->values[2]); - xSnprintf(buffer, len, "%s %s %.2lf%% %.2lf%% %.2lf%%", some ? "some" : "full", file, this->values[0], this->values[1], this->values[2]); + + /* only print bar for ten (not sixty and threehundred), cause the sum is meaningless */ + this->curItems = 1; + + xSnprintf(buffer, len, "%s %s %5.2lf%% %5.2lf%% %5.2lf%%", some ? "some" : "full", file, this->values[0], this->values[1], this->values[2]); } static void PressureStallMeter_display(const Object* cast, RichString* out) { const Meter* this = (const Meter*)cast; char buffer[20]; - xSnprintf(buffer, sizeof(buffer), "%.2lf%% ", this->values[0]); + xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[0]); RichString_writeAscii(out, CRT_colors[PRESSURE_STALL_TEN], buffer); - xSnprintf(buffer, sizeof(buffer), "%.2lf%% ", this->values[1]); + xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[1]); RichString_appendAscii(out, CRT_colors[PRESSURE_STALL_SIXTY], buffer); - xSnprintf(buffer, sizeof(buffer), "%.2lf%% ", this->values[2]); + xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[2]); RichString_appendAscii(out, CRT_colors[PRESSURE_STALL_THREEHUNDRED], buffer); } -- cgit v1.2.3