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
98e43816
Commit
98e43816
authored
Mar 07, 2016
by
Hisham Muhammad
Browse files
Merge branch 'master' of
https://github.com/Sp1l/htop
into Sp1l-master
parents
694addce
f554f08f
Changes
2
Hide whitespace changes
Inline
Side-by-side
freebsd/FreeBSDProcessList.c
View file @
98e43816
...
...
@@ -86,6 +86,8 @@ static int MIB_kern_cp_time[2];
static
int
MIB_kern_cp_times
[
2
];
static
int
kernelFScale
;
// XXX hack
static
unsigned
long
long
int
Global_totalMem
;
ProcessList
*
ProcessList_new
(
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
size_t
len
;
...
...
@@ -305,6 +307,8 @@ static inline void FreeBSDProcessList_scanMemoryInfo(ProcessList* pl) {
//pl->totalMem *= pageSizeKb;
sysctl
(
MIB_hw_physmem
,
2
,
&
(
pl
->
totalMem
),
&
len
,
NULL
,
0
);
pl
->
totalMem
/=
1024
;
// XXX hack
Global_totalMem
=
pl
->
totalMem
;
sysctl
(
MIB_vm_stats_vm_v_active_count
,
4
,
&
(
fpl
->
memActive
),
&
len
,
NULL
,
0
);
fpl
->
memActive
*=
pageSizeKb
;
...
...
@@ -483,6 +487,7 @@ void ProcessList_goThroughEntries(ProcessList* this) {
// from FreeBSD source /src/usr.bin/top/machine.c
proc
->
m_size
=
kproc
->
ki_size
/
1024
/
pageSizeKb
;
proc
->
m_resident
=
kproc
->
ki_rssize
;
proc
->
percent_mem
=
(
proc
->
m_resident
*
PAGE_SIZE_KB
)
/
(
double
)(
Global_totalMem
)
*
100
.
0
;
proc
->
nlwp
=
kproc
->
ki_numthreads
;
proc
->
time
=
(
kproc
->
ki_runtime
+
5000
)
/
10000
;
...
...
@@ -493,9 +498,6 @@ void ProcessList_goThroughEntries(ProcessList* this) {
// system idle process should own all CPU time left regardless of CPU count
if
(
strcmp
(
"idle"
,
kproc
->
ki_comm
)
==
0
)
{
isIdleProcess
=
true
;
}
else
{
if
(
cpus
>
1
)
proc
->
percent_cpu
=
proc
->
percent_cpu
/
(
double
)
cpus
;
}
}
if
(
isIdleProcess
==
false
&&
proc
->
percent_cpu
>=
99
.
8
)
{
...
...
freebsd/Platform.c
View file @
98e43816
...
...
@@ -163,15 +163,15 @@ double Platform_setCPUValues(Meter* this, int cpu) {
double
percent
;
double
*
v
=
this
->
values
;
v
[
CPU_METER_NICE
]
=
cpuData
->
nicePercent
;
v
[
CPU_METER_NORMAL
]
=
cpuData
->
userPercent
;
v
[
CPU_METER_NICE
]
=
cpuData
->
nicePercent
*
cpus
;
v
[
CPU_METER_NORMAL
]
=
cpuData
->
userPercent
*
cpus
;
if
(
this
->
pl
->
settings
->
detailedCPUTime
)
{
v
[
CPU_METER_KERNEL
]
=
cpuData
->
systemPercent
;
v
[
CPU_METER_IRQ
]
=
cpuData
->
irqPercent
;
v
[
CPU_METER_KERNEL
]
=
cpuData
->
systemPercent
*
cpus
;
v
[
CPU_METER_IRQ
]
=
cpuData
->
irqPercent
*
cpus
;
Meter_setItems
(
this
,
4
);
percent
=
v
[
0
]
+
v
[
1
]
+
v
[
2
]
+
v
[
3
];
}
else
{
v
[
2
]
=
cpuData
->
systemAllPercent
;
v
[
2
]
=
cpuData
->
systemAllPercent
*
cpus
;
Meter_setItems
(
this
,
3
);
percent
=
v
[
0
]
+
v
[
1
]
+
v
[
2
];
}
...
...
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