summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2010-08-30 16:39:14 -0700
committerDmitry Shmidt <dimitrysh@google.com>2010-08-30 16:39:14 -0700
commit4358544a3ffde4ffd1e9434b99b2a7179f05cce4 (patch)
treec250a567b03d5104def1472148b890ab7b46725b
parentcb020611f950a326599a1b9b7676b148d51fb772 (diff)
downloadsystem_core-4358544a3ffde4ffd1e9434b99b2a7179f05cce4.zip
system_core-4358544a3ffde4ffd1e9434b99b2a7179f05cce4.tar.gz
system_core-4358544a3ffde4ffd1e9434b99b2a7179f05cce4.tar.bz2
toolbox: top: Add processor field
Change-Id: I9f8e45a963a0773f27ddcd1d249aecac1ab9152e Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--toolbox/top.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/toolbox/top.c b/toolbox/top.c
index daade6d..999c8e1 100644
--- a/toolbox/top.c
+++ b/toolbox/top.c
@@ -65,6 +65,7 @@ struct proc_info {
long unsigned delta_time;
long vss;
long rss;
+ int prs;
int num_threads;
char policy[32];
};
@@ -340,8 +341,9 @@ static int read_stat(char *filename, struct proc_info *proc) {
/* Scan rest of string. */
sscanf(close_paren + 1, " %c %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d "
- "%lu %lu %*d %*d %*d %*d %*d %*d %*d %lu %ld",
- &proc->state, &proc->utime, &proc->stime, &proc->vss, &proc->rss);
+ "%lu %lu %*d %*d %*d %*d %*d %*d %*d %lu %ld "
+ "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %d",
+ &proc->state, &proc->utime, &proc->stime, &proc->vss, &proc->rss, &proc->prs);
return 0;
}
@@ -454,9 +456,9 @@ static void print_procs(void) {
total_delta_time);
printf("\n");
if (!threads)
- printf("%5s %4s %1s %5s %7s %7s %3s %-8s %s\n", "PID", "CPU%", "S", "#THR", "VSS", "RSS", "PCY", "UID", "Name");
+ printf("%5s %2s %4s %1s %5s %7s %7s %3s %-8s %s\n", "PID", "PR", "CPU%", "S", "#THR", "VSS", "RSS", "PCY", "UID", "Name");
else
- printf("%5s %5s %4s %1s %7s %7s %3s %-8s %-15s %s\n", "PID", "TID", "CPU%", "S", "VSS", "RSS", "PCY", "UID", "Thread", "Proc");
+ printf("%5s %5s %2s %4s %1s %7s %7s %3s %-8s %-15s %s\n", "PID", "TID", "PR", "CPU%", "S", "VSS", "RSS", "PCY", "UID", "Thread", "Proc");
for (i = 0; i < num_new_procs; i++) {
proc = new_procs[i];
@@ -478,10 +480,10 @@ static void print_procs(void) {
group_str = group_buf;
}
if (!threads)
- printf("%5d %3ld%% %c %5d %6ldK %6ldK %3s %-8.8s %s\n", proc->pid, proc->delta_time * 100 / total_delta_time, proc->state, proc->num_threads,
+ printf("%5d %2d %3ld%% %c %5d %6ldK %6ldK %3s %-8.8s %s\n", proc->pid, proc->prs, proc->delta_time * 100 / total_delta_time, proc->state, proc->num_threads,
proc->vss / 1024, proc->rss * getpagesize() / 1024, proc->policy, user_str, proc->name[0] != 0 ? proc->name : proc->tname);
else
- printf("%5d %5d %3ld%% %c %6ldK %6ldK %3s %-8.8s %-15s %s\n", proc->pid, proc->tid, proc->delta_time * 100 / total_delta_time, proc->state,
+ printf("%5d %5d %2d %3ld%% %c %6ldK %6ldK %3s %-8.8s %-15s %s\n", proc->pid, proc->tid, proc->prs, proc->delta_time * 100 / total_delta_time, proc->state,
proc->vss / 1024, proc->rss * getpagesize() / 1024, proc->policy, user_str, proc->tname, proc->name);
}
}