Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
ad5d9c25
Commit
ad5d9c25
authored
9 years ago
by
Hisham Muhammad
Browse files
Options
Download
Plain Diff
Merge pull request #308 from SaltwaterC/darwin-swap
Add Darwin swap meter
parents
bef00a4f
8895f098
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
darwin/Platform.c
+9
-3
darwin/Platform.c
darwin/Platform.h
+1
-2
darwin/Platform.h
with
10 additions
and
5 deletions
+10
-5
darwin/Platform.c
View file @
ad5d9c25
...
...
@@ -102,6 +102,7 @@ MeterClass* Platform_meterTypes[] = {
&
LoadAverageMeter_class
,
&
LoadMeter_class
,
&
MemoryMeter_class
,
&
SwapMeter_class
,
&
TasksMeter_class
,
&
BatteryMeter_class
,
&
HostnameMeter_class
,
...
...
@@ -226,7 +227,12 @@ void Platform_setMemoryValues(Meter* mtr) {
mtr
->
values
[
2
]
=
(
double
)
vm
->
inactive_count
*
page_K
;
}
void
Platform_setSwapValues
(
Meter
*
this
)
{
(
void
)
this
;
}
void
Platform_setSwapValues
(
Meter
*
mtr
)
{
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
;
}
This diff is collapsed.
Click to expand it.
darwin/Platform.h
View file @
ad5d9c25
...
...
@@ -42,7 +42,6 @@ double Platform_setCPUValues(Meter* mtr, int cpu);
void
Platform_setMemoryValues
(
Meter
*
mtr
);
void
Platform_setSwapValues
(
Meter
*
this
);
void
Platform_setSwapValues
(
Meter
*
mtr
);
#endif
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help