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
bd459776
Commit
bd459776
authored
Mar 31, 2011
by
Hisham Muhammad
Browse files
retain meter state when it is reinit'ed in the Setup screen
parent
b57b7e9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
CPUMeter.c
View file @
bd459776
...
...
@@ -124,12 +124,15 @@ static void CPUMeter_display(Object* cast, RichString* out) {
static
void
AllCPUsMeter_init
(
Meter
*
this
)
{
int
cpus
=
this
->
pl
->
cpuCount
;
this
->
drawData
=
malloc
(
sizeof
(
Meter
*
)
*
cpus
);
if
(
!
this
->
drawData
)
this
->
drawData
=
calloc
(
sizeof
(
Meter
*
),
cpus
);
Meter
**
meters
=
(
Meter
**
)
this
->
drawData
;
for
(
int
i
=
0
;
i
<
cpus
;
i
++
)
meters
[
i
]
=
Meter_new
(
this
->
pl
,
i
+
1
,
&
CPUMeter
);
this
->
h
=
cpus
;
this
->
mode
=
BAR_METERMODE
;
for
(
int
i
=
0
;
i
<
cpus
;
i
++
)
{
if
(
!
meters
[
i
])
meters
[
i
]
=
Meter_new
(
this
->
pl
,
i
+
1
,
&
CPUMeter
);
meters
[
i
]
->
type
->
init
(
meters
[
i
]);
}
this
->
h
=
Meter_modes
[
this
->
mode
]
->
h
;
}
static
void
AllCPUsMeter_done
(
Meter
*
this
)
{
...
...
Meter.c
View file @
bd459776
...
...
@@ -155,8 +155,9 @@ Meter* Meter_new(ProcessList* pl, int param, MeterType* type) {
}
void
Meter_delete
(
Object
*
cast
)
{
if
(
!
cast
)
return
;
Meter
*
this
=
(
Meter
*
)
cast
;
assert
(
this
!=
NULL
);
if
(
this
->
type
->
done
)
{
this
->
type
->
done
(
this
);
}
...
...
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