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
3a4c0fa2
Commit
3a4c0fa2
authored
Mar 20, 2016
by
Hisham Muhammad
Browse files
Merge pull request #452 from Explorer09/cpu-meter-tweaks
Assert (Platform_meterTypes[0] == &CPUMeter_class)
parents
c8a735e4
328de356
Changes
1
Show whitespace changes
Inline
Side-by-side
AvailableMetersPanel.c
View file @
3a4c0fa2
...
...
@@ -112,20 +112,22 @@ AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* heade
this
->
scr
=
scr
;
Panel_setHeader
(
super
,
"Available meters"
);
// Platform_meterTypes[0] should be always (&CPUMeter_class), which we will
// handle separately in the code below.
for
(
int
i
=
1
;
Platform_meterTypes
[
i
];
i
++
)
{
MeterClass
*
type
=
Platform_meterTypes
[
i
];
if
(
type
!=
&
CPUMeter_class
)
{
assert
(
type
!=
&
CPUMeter_class
)
;
const
char
*
label
=
type
->
description
?
type
->
description
:
type
->
uiName
;
Panel_add
(
super
,
(
Object
*
)
ListItem_new
(
label
,
i
<<
16
));
}
}
// Handle (&CPUMeter_class)
MeterClass
*
type
=
&
CPUMeter_class
;
int
cpus
=
pl
->
cpuCount
;
if
(
cpus
>
1
)
{
Panel_add
(
super
,
(
Object
*
)
ListItem_new
(
"CPU average"
,
0
));
for
(
int
i
=
1
;
i
<=
cpus
;
i
++
)
{
char
buffer
[
50
];
sprintf
(
buffer
,
"%s %d"
,
type
->
uiName
,
i
);
s
n
printf
(
buffer
,
50
,
"%s %d"
,
type
->
uiName
,
i
);
Panel_add
(
super
,
(
Object
*
)
ListItem_new
(
buffer
,
i
));
}
}
else
{
...
...
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