misc: adapt pgms to pids_sort_order change, <PIDS> api

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-06-06 00:00:00 -05:00 committed by Craig Small
parent aa9f00dcaf
commit 5f2570c384
3 changed files with 11 additions and 11 deletions

View File

@ -313,9 +313,9 @@ static void simple_spew(void){
break; break;
case TF_show_proc|TF_show_task: // m and -m options case TF_show_proc|TF_show_task: // m and -m options
procps_pids_sort(Pids_info, pidread->stacks procps_pids_sort(Pids_info, pidread->stacks
, pidread->counts.total, PROCPS_PIDS_TIME_START, PROCPS_SORT_ASCEND); , pidread->counts.total, PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND);
procps_pids_sort(Pids_info, pidread->stacks procps_pids_sort(Pids_info, pidread->stacks
, pidread->counts.total, PROCPS_PIDS_ID_TGID, PROCPS_SORT_ASCEND); , pidread->counts.total, PROCPS_PIDS_ID_TGID, PROCPS_PIDS_ASCEND);
for (i = 0; i < pidread->counts.total; i++) { for (i = 0; i < pidread->counts.total; i++) {
buf = pidread->stacks[i]; buf = pidread->stacks[i];
next_proc: next_proc:
@ -343,7 +343,7 @@ static void prep_forest_sort(void){
incoming = search_format_array("ppid"); incoming = search_format_array("ppid");
if(!incoming) { fprintf(stderr, _("could not find ppid\n")); exit(1); } if(!incoming) { fprintf(stderr, _("could not find ppid\n")); exit(1); }
tmp_list = xmalloc(sizeof(sort_node)); tmp_list = xmalloc(sizeof(sort_node));
tmp_list->reverse = PROCPS_SORT_ASCEND; tmp_list->reverse = PROCPS_PIDS_ASCEND;
tmp_list->typecode = '?'; /* what was this for? */ tmp_list->typecode = '?'; /* what was this for? */
tmp_list->sr = incoming->sr; tmp_list->sr = incoming->sr;
tmp_list->next = sort_list; tmp_list->next = sort_list;
@ -353,7 +353,7 @@ static void prep_forest_sort(void){
incoming = search_format_array("start_time"); incoming = search_format_array("start_time");
if(!incoming) { fprintf(stderr, _("could not find start_time\n")); exit(1); } if(!incoming) { fprintf(stderr, _("could not find start_time\n")); exit(1); }
tmp_list = xmalloc(sizeof(sort_node)); tmp_list = xmalloc(sizeof(sort_node));
tmp_list->reverse = PROCPS_SORT_ASCEND; tmp_list->reverse = PROCPS_PIDS_ASCEND;
tmp_list->typecode = '?'; /* what was this for? */ tmp_list->typecode = '?'; /* what was this for? */
tmp_list->sr = incoming->sr; tmp_list->sr = incoming->sr;
tmp_list->next = sort_list; tmp_list->next = sort_list;

View File

@ -317,9 +317,9 @@ out:
/**************** Parse single sort specifier *******************/ /**************** Parse single sort specifier *******************/
static sort_node *do_one_sort_spec(const char *spec){ static sort_node *do_one_sort_spec(const char *spec){
const format_struct *fs; const format_struct *fs;
enum pids_sort_order reverse = PROCPS_SORT_ASCEND; enum pids_sort_order reverse = PROCPS_PIDS_ASCEND;
if(*spec == '-'){ if(*spec == '-'){
reverse = PROCPS_SORT_DESCEND; reverse = PROCPS_PIDS_DESCEND;
spec++; spec++;
} else if(*spec == '+'){ } else if(*spec == '+'){
spec++; spec++;
@ -452,7 +452,7 @@ static const char *verify_short_sort(const char *arg){
/************ parse short sorting option *************/ /************ parse short sorting option *************/
static const char *short_sort_parse(sf_node *sfn){ static const char *short_sort_parse(sf_node *sfn){
enum pids_sort_order direction = PROCPS_SORT_ASCEND; enum pids_sort_order direction = PROCPS_PIDS_ASCEND;
const char *walk; const char *walk;
int tmp; int tmp;
sort_node *snode; sort_node *snode;
@ -466,10 +466,10 @@ static const char *short_sort_parse(sf_node *sfn){
already_parsed_sort = 1; already_parsed_sort = 1;
return NULL; return NULL;
case '+': case '+':
direction = PROCPS_SORT_ASCEND; direction = PROCPS_PIDS_ASCEND;
break; break;
case '-': case '-':
direction = PROCPS_SORT_DESCEND; direction = PROCPS_PIDS_DESCEND;
break; break;
default: default:
ss = search_shortsort_array(tmp); ss = search_shortsort_array(tmp);

View File

@ -4485,7 +4485,7 @@ static void forest_begin (WIN_t *q) {
} }
#ifndef TREE_SCANALL #ifndef TREE_SCANALL
if (!(procps_pids_sort(Pids_ctx, Seed_ppt, PIDSmaxt if (!(procps_pids_sort(Pids_ctx, Seed_ppt, PIDSmaxt
, PROCPS_PIDS_TIME_START, PROCPS_SORT_ASCEND))) , PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND)))
error_exit(fmtmk(N_fmt(LIB_errorpid_fmt),__LINE__)); error_exit(fmtmk(N_fmt(LIB_errorpid_fmt),__LINE__));
#endif #endif
for (i = 0; i < PIDSmaxt; i++) // avoid any hidepid distortions for (i = 0; i < PIDSmaxt; i++) // avoid any hidepid distortions
@ -5039,7 +5039,7 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
static int window_show (WIN_t *q, int wmax) { static int window_show (WIN_t *q, int wmax) {
#define sORDER CHKw(q, Qsrt_NORMAL) ? PROCPS_SORT_DESCEND : PROCPS_SORT_ASCEND #define sORDER CHKw(q, Qsrt_NORMAL) ? PROCPS_PIDS_DESCEND : PROCPS_PIDS_ASCEND
/* the isBUSY macro determines if a task is 'active' -- /* the isBUSY macro determines if a task is 'active' --
it returns true if some cpu was used since the last sample. it returns true if some cpu was used since the last sample.
( actual 'running' tasks will be a subset of those selected ) */ ( actual 'running' tasks will be a subset of those selected ) */