PAGE_TO_NICE_UNIT(count));
}
-void print_pid_stats(struct pageframe *pf, struct process *process_list)
+void print_pid_stats(struct pageframe *pf, struct process *process_list,
+ struct parse_opts *opts)
{
struct analyze_frames af;
struct process *ps;
biggest = MAX(biggest, ps->pages_present + ps->pages_swapped);
}
- printf(" in ram swapped pid tid name\n");
+ printf(" in ram swapped pid");
+ if (opts->with_threads)
+ printf(" tid");
+ printf(" name\n");
restart:
second_biggest = 0;
if (total == 0)
continue;
- printf("%6lld %sB %6lld %sB %5d %5d %s\n",
+ printf("%6lld %sB %6lld %sB %5d ",
PAGE_TO_NICE(present), PAGE_TO_NICE_UNIT(present),
PAGE_TO_NICE(swapped), PAGE_TO_NICE_UNIT(swapped),
- ps->pid, ps->tid,ps->name);
+ ps->pid);
+
+ if (opts->with_threads)
+ printf("%5d ", ps->tid);
+
+ printf("%s\n", ps->name);
+
count++;
processes++;
}
#include "pagemap.h"
void print_page_stats(struct pageframe *pf);
-void print_pid_stats(struct pageframe *pf, struct process *process_list);
+void print_pid_stats(struct pageframe *pf, struct process *process_list,
+ struct parse_opts *opts);
#endif
memset(&pf, 0, sizeof(pf));
scan_all_pids(&pf, &process_list, &opts);
- print_pid_stats(&pf, process_list);
+ print_pid_stats(&pf, process_list, &opts);
print_page_stats(&pf);
return 0;