23 |
|
#endif |
24 |
|
|
25 |
|
#include <stdio.h> |
26 |
< |
#include <statgrab.h> |
26 |
> |
#include "statgrab.h" |
27 |
|
#ifdef SOLARIS |
28 |
|
#include <kstat.h> |
29 |
|
#include <sys/sysinfo.h> |
30 |
+ |
#include <string.h> |
31 |
|
#endif |
32 |
|
|
33 |
|
page_stat_t *get_page_stats(){ |
35 |
|
kstat_ctl_t *kc; |
36 |
|
kstat_t *ksp; |
37 |
|
cpu_stat_t cs; |
37 |
– |
uint_t swapin, swapout; |
38 |
|
|
39 |
+ |
page_stats.num_pagein=0; |
40 |
+ |
page_stats.num_pageout=0; |
41 |
+ |
page_stats.pages_pagein=0; |
42 |
+ |
page_stats.pages_pageout=0; |
43 |
+ |
|
44 |
|
if ((kc = kstat_open()) == NULL) { |
40 |
– |
errf("kstat_open failure (%m)"); |
45 |
|
return NULL; |
46 |
|
} |
47 |
|
for (ksp = kc->kc_chain; ksp!=NULL; ksp = ksp->ks_next) { |
50 |
|
continue; |
51 |
|
} |
52 |
|
|
53 |
< |
page_stats+=cs.cpu_vminfo.pgswapin; |
54 |
< |
page_stats+=cs.cpu_vminfo.pgswapout; |
53 |
> |
page_stats.num_pagein+=(long long)cs.cpu_vminfo.pgin; |
54 |
> |
page_stats.num_pageout+=(long long)cs.cpu_vminfo.pgout; |
55 |
> |
page_stats.pages_pagein+=(long long)cs.cpu_vminfo.pgpgin; |
56 |
> |
page_stats.pages_pageout+=(long long)cs.cpu_vminfo.pgpgout; |
57 |
> |
} |
58 |
|
|
59 |
+ |
page_stats.systime=time(NULL); |
60 |
+ |
|
61 |
+ |
kstat_close(kc); |
62 |
+ |
|
63 |
+ |
return &page_stats; |
64 |
|
} |