diff options
author | Daniel Lange <DLange@git.local> | 2021-09-21 08:35:19 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2021-09-21 08:35:19 +0200 |
commit | 69f439eff387a6ecb52734e400b297a3c85f2285 (patch) | |
tree | 2a988b7868b749654796183ba70b4272965da1bf /linux/PressureStallMeter.c | |
parent | c55320e9e2a8916e911bcd39ab37b79e3a7d03b2 (diff) | |
download | debian_htop-69f439eff387a6ecb52734e400b297a3c85f2285.tar.gz debian_htop-69f439eff387a6ecb52734e400b297a3c85f2285.tar.bz2 debian_htop-69f439eff387a6ecb52734e400b297a3c85f2285.zip |
New upstream version 3.1.0upstream/3.1.0
Diffstat (limited to 'linux/PressureStallMeter.c')
-rw-r--r-- | linux/PressureStallMeter.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/linux/PressureStallMeter.c b/linux/PressureStallMeter.c index 7486968..ff34f9b 100644 --- a/linux/PressureStallMeter.c +++ b/linux/PressureStallMeter.c @@ -6,7 +6,7 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "PressureStallMeter.h" +#include "linux/PressureStallMeter.h" #include <stdbool.h> #include <string.h> @@ -25,7 +25,7 @@ static const int PressureStallMeter_attributes[] = { PRESSURE_STALL_THREEHUNDRED }; -static void PressureStallMeter_updateValues(Meter* this, char* buffer, size_t len) { +static void PressureStallMeter_updateValues(Meter* this) { const char* file; if (strstr(Meter_name(this), "CPU")) { file = "cpu"; @@ -47,18 +47,20 @@ static void PressureStallMeter_updateValues(Meter* this, char* buffer, size_t le /* 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]); + xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%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), "%5.2lf%% ", this->values[0]); - RichString_writeAscii(out, CRT_colors[PRESSURE_STALL_TEN], buffer); - xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[1]); - RichString_appendAscii(out, CRT_colors[PRESSURE_STALL_SIXTY], buffer); - xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[2]); - RichString_appendAscii(out, CRT_colors[PRESSURE_STALL_THREEHUNDRED], buffer); + int len; + + len = xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[0]); + RichString_appendnAscii(out, CRT_colors[PRESSURE_STALL_TEN], buffer, len); + len = xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[1]); + RichString_appendnAscii(out, CRT_colors[PRESSURE_STALL_SIXTY], buffer, len); + len = xSnprintf(buffer, sizeof(buffer), "%5.2lf%% ", this->values[2]); + RichString_appendnAscii(out, CRT_colors[PRESSURE_STALL_THREEHUNDRED], buffer, len); } const MeterClass PressureStallCPUSomeMeter_class = { |