Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
d34645f8
You need to sign in or sign up before continuing.
Commit
d34645f8
authored
Nov 23, 2015
by
Hisham Muhammad
Browse files
Array entries have been oddly flipped here for years.
parent
f02d8f43
Changes
3
Hide whitespace changes
Inline
Side-by-side
LoadAverageMeter.c
View file @
d34645f8
...
...
@@ -15,25 +15,25 @@ in the source distribution for its full text.
}*/
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
};
static
void
LoadAverageMeter_setValues
(
Meter
*
this
,
char
*
buffer
,
int
size
)
{
Platform_getLoadAverage
(
&
this
->
values
[
2
],
&
this
->
values
[
1
],
&
this
->
values
[
0
]);
snprintf
(
buffer
,
size
,
"%.2f/%.2f/%.2f"
,
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
[
0
],
this
->
values
[
1
],
this
->
values
[
2
]);
}
static
void
LoadAverageMeter_display
(
Object
*
cast
,
RichString
*
out
)
{
Meter
*
this
=
(
Meter
*
)
cast
;
char
buffer
[
20
];
sprintf
(
buffer
,
"%.2f "
,
this
->
values
[
2
]);
RichString_write
(
out
,
CRT_colors
[
LOAD_AVERAGE_
FIFTEEN
],
buffer
);
sprintf
(
buffer
,
"%.2f "
,
this
->
values
[
0
]);
RichString_write
(
out
,
CRT_colors
[
LOAD_AVERAGE_
ONE
],
buffer
);
sprintf
(
buffer
,
"%.2f "
,
this
->
values
[
1
]);
RichString_append
(
out
,
CRT_colors
[
LOAD_AVERAGE_FIVE
],
buffer
);
sprintf
(
buffer
,
"%.2f "
,
this
->
values
[
0
]);
RichString_append
(
out
,
CRT_colors
[
LOAD_AVERAGE_
ONE
],
buffer
);
sprintf
(
buffer
,
"%.2f "
,
this
->
values
[
2
]);
RichString_append
(
out
,
CRT_colors
[
LOAD_AVERAGE_
FIFTEEN
],
buffer
);
}
static
void
LoadMeter_setValues
(
Meter
*
this
,
char
*
buffer
,
int
size
)
{
...
...
Meter.c
View file @
d34645f8
...
...
@@ -251,7 +251,6 @@ static void TextMeterMode_draw(Meter* this, int x, int y, int w) {
mvaddstr
(
y
,
x
,
this
->
caption
);
int
captionLen
=
strlen
(
this
->
caption
);
x
+=
captionLen
;
mvhline
(
y
,
x
,
' '
,
CRT_colors
[
DEFAULT_COLOR
]);
attrset
(
CRT_colors
[
RESET_COLOR
]);
RichString_begin
(
out
);
Meter_displayBuffer
(
this
,
buffer
,
&
out
);
...
...
RichString.c
View file @
d34645f8
...
...
@@ -100,8 +100,7 @@ static inline void RichString_writeFrom(RichString* this, int attrs, const char*
int
newLen
=
from
+
len
;
RichString_setLen
(
this
,
newLen
);
for
(
int
i
=
from
,
j
=
0
;
i
<
newLen
;
i
++
,
j
++
)
{
CharType
*
c
=
&
(
this
->
chptr
[
i
]);
*
c
=
(
CharType
)
{
.
attr
=
attrs
,
.
chars
=
{
(
iswprint
(
data
[
j
])
?
data
[
j
]
:
'?'
)
}
};
this
->
chptr
[
i
]
=
(
CharType
)
{
.
attr
=
attrs
&
0xffffff
,
.
chars
=
{
(
iswprint
(
data
[
j
])
?
data
[
j
]
:
'?'
)
}
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment