Project

General

Profile

Submit #2741 ยป 0001-top-1-ability-to-display-individual-threads.patch

lelf, 11/28/2014 12:31 AM

View differences:

usr.bin/top/m_dragonfly.c
statics->order_names = ordernames;
/* we need kvm descriptor in order to show full commands */
statics->flags.fullcmds = kd != NULL;
statics->flags.threads = 1;
/* all done! */
return (0);
......
char status[16];
int state;
int xnice;
int prefer_fullcmd;
char **comm_full;
char *comm;
char cputime_fmt[10], ccputime_fmt[10];
......
hp->remaining--;
/* get the process's command name */
prefer_fullcmd = show_fullcmd;
if (show_fullcmd) {
if ((comm_full = kvm_getargv(kd, pp, 0)) == NULL) {
prefer_fullcmd = 0;
char **comm_full = kvm_getargv(kd, pp, 0);
if (comm_full != 0)
comm = *comm_full;
else
comm = PP(pp, comm);
}
}
else {
comm = PP(pp, comm);
}
/* the actual field to display */
char cmdfield[MAX_COLS];
if (PP(pp, flags) & P_SYSTEM) {
/* system process */
snprintf(cmdfield, sizeof cmdfield, "[%s]", comm);
} else if (LP(pp, tid) > 0) {
/* display it as a thread */
snprintf(cmdfield, sizeof cmdfield, "%s{%d}", comm, LP(pp, tid));
} else {
snprintf(cmdfield, sizeof cmdfield, "%s", comm);
}
/*
* Convert the process's runtime from microseconds to seconds. This
......
ccputime_fmt,
100.0 * pct,
cmdlength,
prefer_fullcmd ? *comm_full : comm);
cmdfield);
/* return the result */
return (fmt);
    (1-1/1)