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
90d56753
Commit
90d56753
authored
May 28, 2012
by
Hisham Muhammad
Browse files
Fix CPU percentage. Patch 3522180 for bug 3516978, by Richard.
parent
05a78c81
Changes
1
Hide whitespace changes
Inline
Side-by-side
ProcessList.c
View file @
90d56753
...
...
@@ -677,7 +677,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
unsigned
long
long
int
lasttimes
=
(
process
->
utime
+
process
->
stime
);
if
(
!
ProcessList_readStatFile
(
process
,
dirname
,
name
,
command
))
goto
errorReadingProcess
;
in
t
percent_cpu
=
(
process
->
utime
+
process
->
stime
-
lasttimes
)
/
period
*
100
.
0
;
floa
t
percent_cpu
=
(
process
->
utime
+
process
->
stime
-
lasttimes
)
/
period
*
100
.
0
;
process
->
percent_cpu
=
MAX
(
MIN
(
percent_cpu
,
cpus
*
100
.
0
),
0
.
0
);
if
(
isnan
(
process
->
percent_cpu
))
process
->
percent_cpu
=
0
.
0
;
process
->
percent_mem
=
(
process
->
m_resident
*
PAGE_SIZE_KB
)
/
(
double
)(
this
->
totalMem
)
*
100
.
0
;
...
...
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