Lines 61-66
Link Here
|
61 |
extern char* printable(char *); |
61 |
extern char* printable(char *); |
62 |
int swapmode(int *retavail, int *retfree); |
62 |
int swapmode(int *retavail, int *retfree); |
63 |
static int smpmode; |
63 |
static int smpmode; |
|
|
64 |
static int ncpu; |
65 |
#define NCPU 2 /* support max 2cpu to display frequency */ |
64 |
enum displaymodes displaymode; |
66 |
enum displaymodes displaymode; |
65 |
static int namelength = 8; |
67 |
static int namelength = 8; |
66 |
static int cmdlengthdelta; |
68 |
static int cmdlengthdelta; |
Lines 153-162
Link Here
|
153 |
|
155 |
|
154 |
/* these are for detailing the process states */ |
156 |
/* these are for detailing the process states */ |
155 |
|
157 |
|
156 |
int process_states[8]; |
158 |
int process_states[8+NCPU]; |
157 |
char *procstatenames[] = { |
159 |
char *procstatenames[] = { |
158 |
"", " starting, ", " running, ", " sleeping, ", " stopped, ", |
160 |
"", " starting, ", " running, ", " sleeping, ", " stopped, ", |
159 |
" zombie, ", " waiting, ", " lock, ", |
161 |
" zombie, ", " waiting, ", " lock, ", " MHz, ", " MHz, ", |
160 |
NULL |
162 |
NULL |
161 |
}; |
163 |
}; |
162 |
|
164 |
|
Lines 235-240
Link Here
|
235 |
modelen != sizeof(smpmode)) |
237 |
modelen != sizeof(smpmode)) |
236 |
smpmode = 0; |
238 |
smpmode = 0; |
237 |
|
239 |
|
|
|
240 |
for (ncpu = -1; ncpu < NCPU; ncpu++) { |
241 |
char buf[32]; |
242 |
snprintf(buf, sizeof buf-1, "dev.cpu.%d.freq", ncpu+1); |
243 |
if (sysctlbyname(buf, NULL, NULL, NULL, 0) < 0) |
244 |
break; |
245 |
} |
246 |
|
238 |
while ((pw = getpwent()) != NULL) { |
247 |
while ((pw = getpwent()) != NULL) { |
239 |
if (strlen(pw->pw_name) > namelength) |
248 |
if (strlen(pw->pw_name) > namelength) |
240 |
namelength = strlen(pw->pw_name); |
249 |
namelength = strlen(pw->pw_name); |
Lines 630-635
Link Here
|
630 |
} |
639 |
} |
631 |
} |
640 |
} |
632 |
|
641 |
|
|
|
642 |
/* CPU current frequency */ |
643 |
if (ncpu != -1) { |
644 |
int j; |
645 |
for(j = 0; j <= ncpu; j++) { |
646 |
char buf[32]; |
647 |
snprintf(buf, sizeof buf-1, "dev.cpu.%d.freq", j); |
648 |
GETSYSCTL(buf, process_states[j+8]); |
649 |
} |
650 |
} |
651 |
|
652 |
|
633 |
/* if requested, sort the "interesting" processes */ |
653 |
/* if requested, sort the "interesting" processes */ |
634 |
if (compare != NULL) |
654 |
if (compare != NULL) |
635 |
qsort(pref, active_procs, sizeof(*pref), compare); |
655 |
qsort(pref, active_procs, sizeof(*pref), compare); |