#include <pwd.h>
#include <sys/utsname.h>
#include <regex.h>
+#include <linux/sched.h>
#include "version.h"
#include "pidstat.h"
sprintf(format, "%%*d (%%%ds %%*s %%*d %%*d %%*d %%*d %%*d %%*u %%lu %%lu"
" %%lu %%lu %%lu %%lu %%lu %%lu %%*d %%*d %%u %%*u %%*d %%lu %%lu"
" %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u %%*u"
- " %%*u %%u %%*u %%*u %%llu %%lu %%lu\\n", MAX_COMM_LEN);
+ " %%*u %%u %%u %%u %%llu %%lu %%lu\\n", MAX_COMM_LEN);
fscanf(fp, format, comm,
&pst->minflt, &pst->cminflt, &pst->majflt, &pst->cmajflt,
&pst->utime, &pst->stime, &pst->cutime, &pst->cstime,
thread_nr, &pst->vsz, &pst->rss, &pst->processor,
+ &pst->priority, &pst->policy,
&pst->blkio_swapin_delays, &pst->gtime, &pst->cgtime);
fclose(fp);
if (DISPLAY_CTXSW(activity) && (!isActive)) {
if (((*pstc)->nvcsw != (*pstp)->nvcsw) ||
- ((*pstc)->nivcsw != (*pstp)->nivcsw)) {
+ ((*pstc)->nivcsw != (*pstp)->nivcsw) ||
+ ((*pstc)->priority != (*pstp)->priority) ||
+ ((*pstc)->policy != (*pstp)->policy)) {
isActive = TRUE;
}
}
printf(" kB_rd/s kB_wr/s kB_ccwr/s iodelay");
}
if (DISPLAY_CTXSW(actflag)) {
- printf(" cswch/s nvcswch/s");
+ printf(" cswch/s nvcswch/s prio policy");
}
if (DISPLAY_KTAB(actflag)) {
printf(" threads fd-nr");
}
if (DISPLAY_CTXSW(actflag)) {
- printf(" %9.2f %9.2f",
+ printf(" %9.2f %9.2f %4u %6s",
S_VALUE(pstp->nvcsw, pstc->nvcsw, itv),
- S_VALUE(pstp->nivcsw, pstc->nivcsw, itv));
+ S_VALUE(pstp->nivcsw, pstc->nivcsw, itv),
+ pstc->priority,
+ PRINT_POLICY(pstc->policy));
}
if (DISPLAY_KTAB(actflag)) {
if (dis) {
PRINT_ID_HDR(prev_string, pidflag);
- printf(" cswch/s nvcswch/s Command\n");
+ printf(" cswch/s nvcswch/s prio policy Command\n");
}
for (p = 0; p < pid_nr; p++) {
continue;
print_line_id(curr_string, pstc);
- printf(" %9.2f %9.2f",
+ printf(" %9.2f %9.2f %4u %6s",
S_VALUE(pstp->nvcsw, pstc->nvcsw, itv),
- S_VALUE(pstp->nivcsw, pstc->nivcsw, itv));
+ S_VALUE(pstp->nivcsw, pstc->nivcsw, itv),
+ pstc->priority,
+ PRINT_POLICY(pstc->policy));
print_comm(pstc);
again = 1;
}
} \
} while (0)
+#define PRINT_POLICY(p) \
+ (p == SCHED_NORMAL ? "NORMAL" : \
+ (p == SCHED_FIFO ? "FIFO" : \
+ (p == SCHED_RR ? "RR" : \
+ (p == SCHED_BATCH ? "BATCH" : \
+ (p == SCHED_IDLE ? "IDLE" : \
+ "?")))))
+
struct pid_stats {
unsigned long long read_bytes __attribute__ ((aligned (8)));
unsigned long long write_bytes __attribute__ ((packed));
unsigned int sk_asum_count __attribute__ ((packed));
unsigned int delay_asum_count __attribute__ ((packed));
unsigned int processor __attribute__ ((packed));
+ unsigned int priority __attribute__ ((packed));
+ unsigned int policy __attribute__ ((packed));
unsigned int flags __attribute__ ((packed));
unsigned int uid __attribute__ ((packed));
unsigned int threads __attribute__ ((packed));