aboutsummaryrefslogtreecommitdiffstats
path: root/LoadAverageMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:20 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:20 +0200
commit85bb4ad9cb820ac3b8e935a930084a06cbfd2847 (patch)
tree681fd9b2d9fa80931b2a8bec4bb6667865b7c569 /LoadAverageMeter.c
parentea859f50d9438bc61ae96721a4d255b49de78653 (diff)
downloaddebian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.tar.gz
debian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.tar.bz2
debian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.zip
Imported Upstream version 0.6.3upstream/0.6.3
Diffstat (limited to 'LoadAverageMeter.c')
-rw-r--r--LoadAverageMeter.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index 4f62260..ab06beb 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -12,10 +12,10 @@ in the source distribution for its full text.
#include "debug.h"
-/* private property */
-int LoadAverageMeter_attributes[] = { LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE };
+int LoadAverageMeter_attributes[] = {
+ LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE
+};
-/* private */
MeterType LoadAverageMeter = {
.setValues = LoadAverageMeter_setValues,
.display = LoadAverageMeter_display,
@@ -28,10 +28,8 @@ MeterType LoadAverageMeter = {
.caption = "Load average: "
};
-/* private property */
int LoadMeter_attributes[] = { LOAD };
-/* private */
MeterType LoadMeter = {
.setValues = LoadMeter_setValues,
.display = LoadMeter_display,
@@ -44,8 +42,7 @@ MeterType LoadMeter = {
.caption = "Load: "
};
-/* private */
-inline static void LoadAverageMeter_scan(double* one, double* five, double* fifteen) {
+static inline void LoadAverageMeter_scan(double* one, double* five, double* fifteen) {
int activeProcs, totalProcs, lastProc;
FILE *fd = fopen(PROCDIR "/loadavg", "r");
int read = fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen,
@@ -63,7 +60,7 @@ void LoadAverageMeter_setValues(Meter* this, char* buffer, int size) {
void LoadAverageMeter_display(Object* cast, RichString* out) {
Meter* this = (Meter*)cast;
char buffer[20];
- RichString_prune(out);
+ RichString_init(out);
sprintf(buffer, "%.2f ", this->values[2]);
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer);
sprintf(buffer, "%.2f ", this->values[1]);
@@ -84,7 +81,7 @@ void LoadMeter_setValues(Meter* this, char* buffer, int size) {
void LoadMeter_display(Object* cast, RichString* out) {
Meter* this = (Meter*)cast;
char buffer[20];
- RichString_prune(out);
+ RichString_init(out);
sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]);
RichString_append(out, CRT_colors[LOAD], buffer);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy