23 |
|
#endif |
24 |
|
|
25 |
|
#include <stdio.h> |
26 |
– |
#include <ukcprog.h> |
26 |
|
#include <unistd.h> |
27 |
|
#include <stdlib.h> |
29 |
– |
#include <sys/types.h> |
28 |
|
#include <time.h> |
29 |
|
#include <string.h> |
30 |
|
#include "statgrab.h" |
32 |
|
#include <kstat.h> |
33 |
|
#include <sys/sysinfo.h> |
34 |
|
#endif |
37 |
– |
#ifdef FREEBSD |
38 |
– |
#include <sys/sysctl.h> |
39 |
– |
#include <sys/dkstat.h> |
40 |
– |
#endif |
35 |
|
|
36 |
|
static cpu_states_t cpu_now; |
37 |
|
static int cpu_now_uninit=1; |
38 |
|
|
45 |
– |
|
39 |
|
cpu_states_t *get_cpu_totals(){ |
40 |
|
|
41 |
|
#ifdef SOLARIS |
70 |
|
cpu_now.total=cpu_now.user+cpu_now.iowait+cpu_now.kernel+cpu_now.idle+cpu_now.swap; |
71 |
|
cpu_now_uninit=0; |
72 |
|
|
73 |
< |
if((kstat_close(kc)) != 0){ |
81 |
< |
return NULL; |
82 |
< |
} |
83 |
< |
|
73 |
> |
kstat_close(kc); |
74 |
|
#endif |
75 |
|
|
76 |
|
cpu_now.systime=time(NULL); |