mirror of https://github.com/xzeldon/htop.git
Array entries have been oddly flipped here for years.
This commit is contained in:
parent
f02d8f4386
commit
d34645f8f1
|
@ -15,25 +15,25 @@ in the source distribution for its full text.
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
int LoadAverageMeter_attributes[] = {
|
int LoadAverageMeter_attributes[] = {
|
||||||
LOAD_AVERAGE_FIFTEEN, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_ONE
|
LOAD_AVERAGE_ONE, LOAD_AVERAGE_FIVE, LOAD_AVERAGE_FIFTEEN
|
||||||
};
|
};
|
||||||
|
|
||||||
int LoadMeter_attributes[] = { LOAD };
|
int LoadMeter_attributes[] = { LOAD };
|
||||||
|
|
||||||
static void LoadAverageMeter_setValues(Meter* this, char* buffer, int size) {
|
static void LoadAverageMeter_setValues(Meter* this, char* buffer, int size) {
|
||||||
Platform_getLoadAverage(&this->values[2], &this->values[1], &this->values[0]);
|
Platform_getLoadAverage(&this->values[0], &this->values[1], &this->values[2]);
|
||||||
snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[2], this->values[1], this->values[0]);
|
snprintf(buffer, size, "%.2f/%.2f/%.2f", this->values[0], this->values[1], this->values[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadAverageMeter_display(Object* cast, RichString* out) {
|
static void LoadAverageMeter_display(Object* cast, RichString* out) {
|
||||||
Meter* this = (Meter*)cast;
|
Meter* this = (Meter*)cast;
|
||||||
char buffer[20];
|
char buffer[20];
|
||||||
sprintf(buffer, "%.2f ", this->values[2]);
|
sprintf(buffer, "%.2f ", this->values[0]);
|
||||||
RichString_write(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer);
|
RichString_write(out, CRT_colors[LOAD_AVERAGE_ONE], buffer);
|
||||||
sprintf(buffer, "%.2f ", this->values[1]);
|
sprintf(buffer, "%.2f ", this->values[1]);
|
||||||
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer);
|
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIVE], buffer);
|
||||||
sprintf(buffer, "%.2f ", this->values[0]);
|
sprintf(buffer, "%.2f ", this->values[2]);
|
||||||
RichString_append(out, CRT_colors[LOAD_AVERAGE_ONE], buffer);
|
RichString_append(out, CRT_colors[LOAD_AVERAGE_FIFTEEN], buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadMeter_setValues(Meter* this, char* buffer, int size) {
|
static void LoadMeter_setValues(Meter* this, char* buffer, int size) {
|
||||||
|
|
1
Meter.c
1
Meter.c
|
@ -251,7 +251,6 @@ static void TextMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
mvaddstr(y, x, this->caption);
|
mvaddstr(y, x, this->caption);
|
||||||
int captionLen = strlen(this->caption);
|
int captionLen = strlen(this->caption);
|
||||||
x += captionLen;
|
x += captionLen;
|
||||||
mvhline(y, x, ' ', CRT_colors[DEFAULT_COLOR]);
|
|
||||||
attrset(CRT_colors[RESET_COLOR]);
|
attrset(CRT_colors[RESET_COLOR]);
|
||||||
RichString_begin(out);
|
RichString_begin(out);
|
||||||
Meter_displayBuffer(this, buffer, &out);
|
Meter_displayBuffer(this, buffer, &out);
|
||||||
|
|
|
@ -100,8 +100,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char*
|
||||||
int newLen = from + len;
|
int newLen = from + len;
|
||||||
RichString_setLen(this, newLen);
|
RichString_setLen(this, newLen);
|
||||||
for (int i = from, j = 0; i < newLen; i++, j++) {
|
for (int i = from, j = 0; i < newLen; i++, j++) {
|
||||||
CharType* c = &(this->chptr[i]);
|
this->chptr[i] = (CharType) { .attr = attrs & 0xffffff, .chars = { (iswprint(data[j]) ? data[j] : '?') } };
|
||||||
*c = (CharType) { .attr = attrs, .chars = { (iswprint(data[j]) ? data[j] : '?') } };
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue