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
7fd4af80
Commit
7fd4af80
authored
Mar 16, 2015
by
Hisham Muhammad
Browse files
Linux build fixes.
parent
5c8b8340
Changes
4
Show whitespace changes
Inline
Side-by-side
linux/LinuxProcess.h
View file @
7fd4af80
...
...
@@ -75,7 +75,7 @@ typedef enum LinuxProcessFields {
OOM
=
114
,
#endif
IO_PRIORITY
=
115
,
LAST_PROCESSFIELD
LAST_PROCESSFIELD
=
116
,
}
LinuxProcessField
;
#include "IOPriority.h"
...
...
linux/LinuxProcessList.c
View file @
7fd4af80
...
...
@@ -475,6 +475,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
}
static
bool
LinuxProcessList_processEntries
(
LinuxProcessList
*
this
,
const
char
*
dirname
,
Process
*
parent
,
double
period
,
struct
timeval
tv
)
{
ProcessList
*
pl
=
(
ProcessList
*
)
this
;
DIR
*
dir
;
struct
dirent
*
entry
;
Settings
*
settings
=
this
->
super
.
settings
;
...
...
@@ -551,7 +552,7 @@ static bool LinuxProcessList_processEntries(LinuxProcessList* this, const char*
float
percent_cpu
=
(
lp
->
utime
+
lp
->
stime
-
lasttimes
)
/
period
*
100
.
0
;
proc
->
percent_cpu
=
MAX
(
MIN
(
percent_cpu
,
cpus
*
100
.
0
),
0
.
0
);
if
(
isnan
(
proc
->
percent_cpu
))
proc
->
percent_cpu
=
0
.
0
;
proc
->
percent_mem
=
(
proc
->
m_resident
*
PAGE_SIZE_KB
)
/
(
double
)(
this
->
totalMem
)
*
100
.
0
;
proc
->
percent_mem
=
(
proc
->
m_resident
*
PAGE_SIZE_KB
)
/
(
double
)(
pl
->
totalMem
)
*
100
.
0
;
if
(
!
existingProc
)
{
...
...
@@ -633,7 +634,7 @@ static bool LinuxProcessList_processEntries(LinuxProcessList* this, const char*
return
true
;
}
static
inline
void
LinuxProcessList_scanMemoryInfo
(
Linux
ProcessList
*
this
)
{
static
inline
void
LinuxProcessList_scanMemoryInfo
(
ProcessList
*
this
)
{
unsigned
long
long
int
swapFree
=
0
;
FILE
*
file
=
fopen
(
PROCMEMINFOFILE
,
"r"
);
...
...
@@ -754,7 +755,7 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
void
ProcessList_scan
(
ProcessList
*
super
)
{
LinuxProcessList
*
this
=
(
LinuxProcessList
*
)
super
;
LinuxProcessList_scanMemoryInfo
(
this
);
LinuxProcessList_scanMemoryInfo
(
super
);
double
period
=
LinuxProcessList_scanCPUTime
(
this
);
...
...
linux/LinuxProcessList.h
View file @
7fd4af80
...
...
@@ -50,16 +50,6 @@ typedef struct LinuxProcessList_ {
CPUData
*
cpus
;
unsigned
long
long
int
totalMem
;
unsigned
long
long
int
usedMem
;
unsigned
long
long
int
freeMem
;
unsigned
long
long
int
sharedMem
;
unsigned
long
long
int
buffersMem
;
unsigned
long
long
int
cachedMem
;
unsigned
long
long
int
totalSwap
;
unsigned
long
long
int
usedSwap
;
unsigned
long
long
int
freeSwap
;
}
LinuxProcessList
;
#ifndef PROCDIR
...
...
linux/Platform.c
View file @
7fd4af80
...
...
@@ -149,7 +149,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
}
void
Platform_setMemoryValues
(
Meter
*
this
)
{
Linux
ProcessList
*
pl
=
(
Linux
ProcessList
*
)
this
->
pl
;
ProcessList
*
pl
=
(
ProcessList
*
)
this
->
pl
;
long
int
usedMem
=
pl
->
usedMem
;
long
int
buffersMem
=
pl
->
buffersMem
;
long
int
cachedMem
=
pl
->
cachedMem
;
...
...
@@ -161,7 +161,7 @@ void Platform_setMemoryValues(Meter* this) {
}
void
Platform_setSwapValues
(
Meter
*
this
)
{
Linux
ProcessList
*
pl
=
(
Linux
ProcessList
*
)
this
->
pl
;
ProcessList
*
pl
=
(
ProcessList
*
)
this
->
pl
;
this
->
total
=
pl
->
totalSwap
;
this
->
values
[
0
]
=
pl
->
usedSwap
;
}
...
...
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