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
8895f098
Commit
8895f098
authored
Nov 16, 2015
by
SaltwaterC
Browse files
Add Darwin swap meter.
parent
bef00a4f
Changes
2
Show whitespace changes
Inline
Side-by-side
darwin/Platform.c
View file @
8895f098
...
@@ -102,6 +102,7 @@ MeterClass* Platform_meterTypes[] = {
...
@@ -102,6 +102,7 @@ MeterClass* Platform_meterTypes[] = {
&
LoadAverageMeter_class
,
&
LoadAverageMeter_class
,
&
LoadMeter_class
,
&
LoadMeter_class
,
&
MemoryMeter_class
,
&
MemoryMeter_class
,
&
SwapMeter_class
,
&
TasksMeter_class
,
&
TasksMeter_class
,
&
BatteryMeter_class
,
&
BatteryMeter_class
,
&
HostnameMeter_class
,
&
HostnameMeter_class
,
...
@@ -226,7 +227,12 @@ void Platform_setMemoryValues(Meter* mtr) {
...
@@ -226,7 +227,12 @@ void Platform_setMemoryValues(Meter* mtr) {
mtr
->
values
[
2
]
=
(
double
)
vm
->
inactive_count
*
page_K
;
mtr
->
values
[
2
]
=
(
double
)
vm
->
inactive_count
*
page_K
;
}
}
void
Platform_setSwapValues
(
Meter
*
this
)
{
void
Platform_setSwapValues
(
Meter
*
mtr
)
{
(
void
)
this
;
int
mib
[
2
]
=
{
CTL_VM
,
VM_SWAPUSAGE
};
}
struct
xsw_usage
swapused
;
size_t
swlen
=
sizeof
(
swapused
);
sysctl
(
mib
,
2
,
&
swapused
,
&
swlen
,
NULL
,
0
);
mtr
->
total
=
swapused
.
xsu_total
/
1024
;
mtr
->
values
[
0
]
=
swapused
.
xsu_used
/
1024
;
}
darwin/Platform.h
View file @
8895f098
...
@@ -42,7 +42,6 @@ double Platform_setCPUValues(Meter* mtr, int cpu);
...
@@ -42,7 +42,6 @@ double Platform_setCPUValues(Meter* mtr, int cpu);
void
Platform_setMemoryValues
(
Meter
*
mtr
);
void
Platform_setMemoryValues
(
Meter
*
mtr
);
void
Platform_setSwapValues
(
Meter
*
this
);
void
Platform_setSwapValues
(
Meter
*
mtr
);
#endif
#endif
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