|
@ -518,6 +518,7 @@ void parse_file(pid_t pid) |
|
|
FILE *fp; |
|
|
FILE *fp; |
|
|
struct proc *p; |
|
|
struct proc *p; |
|
|
int i; |
|
|
int i; |
|
|
|
|
|
int slot; |
|
|
|
|
|
|
|
|
sprintf(path, "/proc/%d/psinfo", pid); |
|
|
sprintf(path, "/proc/%d/psinfo", pid); |
|
|
|
|
|
|
|
@ -545,6 +546,7 @@ void parse_file(pid_t pid) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
slot++; |
|
|
slot++; |
|
|
|
|
|
slot = SLOT_NR(endpt); |
|
|
|
|
|
|
|
|
if (slot < 0 || slot >= nr_total) |
|
|
if (slot < 0 || slot >= nr_total) |
|
|
{ |
|
|
{ |
|
@ -698,3 +700,28 @@ void print_procs(struct proc *proc1, struct proc *proc2, int cputimemode) |
|
|
printf("%6.2f%% system", 100.0 * systemticks / total_ticks); |
|
|
printf("%6.2f%% system", 100.0 * systemticks / total_ticks); |
|
|
printf("%6.2f%% in total\n", 100.0 * (systemticks + userticks) / total_ticks); |
|
|
printf("%6.2f%% in total\n", 100.0 * (systemticks + userticks) / total_ticks); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
u64_t cputicks(struct proc *p1, struct proc *p2, int timemode) |
|
|
|
|
|
{ |
|
|
|
|
|
int i; |
|
|
|
|
|
u64_t t = 0; |
|
|
|
|
|
for (i = 0; i < CPUTIMENAMES; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (!CPUTIME(timemode, i)) |
|
|
|
|
|
{ |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if (p1->p_endpoint == p2->p_endpoint) |
|
|
|
|
|
{ |
|
|
|
|
|
{ |
|
|
|
|
|
t = t + p2->p_cpucycles[i] - p1->p_cpucycles[i]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
t = t + p2->p_cpucycles[i]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return t; |
|
|
|
|
|
} |