version 1.100, 2006/02/23 06:32:11 |
version 1.101, 2006/03/13 19:29:26 |
|
|
#define VMSTAT 0x20 |
#define VMSTAT 0x20 |
|
|
void cpustats(void); |
void cpustats(void); |
|
time_t getuptime(void); |
void dkstats(void); |
void dkstats(void); |
void dointr(void); |
void dointr(void); |
void domem(void); |
void domem(void); |
|
|
void usage(void); |
void usage(void); |
void dotimes(void); |
void dotimes(void); |
void doforkst(void); |
void doforkst(void); |
|
void needhdr(int); |
|
int pct(long, long); |
void printhdr(void); |
void printhdr(void); |
|
|
char **choosedrives(char **); |
char **choosedrives(char **); |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
extern int optind; |
|
extern char *optarg; |
|
int mib[2]; |
int mib[2]; |
size_t size; |
size_t size; |
int c, todo; |
int c, todo; |
|
|
{ |
{ |
struct vmtotal total; |
struct vmtotal total; |
time_t uptime, halfuptime; |
time_t uptime, halfuptime; |
void needhdr(int); |
|
int mib[2]; |
int mib[2]; |
struct clockinfo clkinfo; |
struct clockinfo clkinfo; |
size_t size; |
size_t size; |
|
|
cpustats(void) |
cpustats(void) |
{ |
{ |
int state; |
int state; |
double pct, total; |
double percent, total; |
|
|
total = 0; |
total = 0; |
for (state = 0; state < CPUSTATES; ++state) |
for (state = 0; state < CPUSTATES; ++state) |
total += cur.cp_time[state]; |
total += cur.cp_time[state]; |
if (total) |
if (total) |
pct = 100 / total; |
percent = 100 / total; |
else |
else |
pct = 0; |
percent = 0; |
(void)printf("%2.0f ", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * pct); |
(void)printf("%2.0f ", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * percent); |
(void)printf("%2.0f ", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * pct); |
(void)printf("%2.0f ", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * percent); |
(void)printf("%2.0f", cur.cp_time[CP_IDLE] * pct); |
(void)printf("%2.0f", cur.cp_time[CP_IDLE] * percent); |
} |
} |
|
|
void |
void |
|
|
/* |
/* |
* These names are defined in <sys/malloc.h>. |
* These names are defined in <sys/malloc.h>. |
*/ |
*/ |
char *kmemnames[] = INITKMEMNAMES; |
const char *kmemnames[] = INITKMEMNAMES; |
|
|
void |
void |
domem(void) |
domem(void) |
|
|
int len, size, first; |
int len, size, first; |
u_long totuse = 0, totfree = 0; |
u_long totuse = 0, totfree = 0; |
quad_t totreq = 0; |
quad_t totreq = 0; |
char *name; |
const char *name; |
struct kmemstats kmemstats[M_LAST]; |
struct kmemstats kmemstats[M_LAST]; |
struct kmembuckets buckets[MINBUCKET + 16]; |
struct kmembuckets buckets[MINBUCKET + 16]; |
int mib[4]; |
int mib[4]; |