pidstat now displays the real user ID of every task being monitored.
Its manual page has also been updated.
receives SIGINT (crtl/c).
* sar now stops and displays its average stats when it receives
SIGINT (crtl/c).
+ * pidstat now displays task's UID for all tasks.
+ * pidstat manual page updated.
* FAQ updated.
2012/12/23: Version 10.1.3 - Sebastien Godard (sysstat <at> orange.fr)
-.TH PIDSTAT 1 "JULY 2012" Linux "Linux User's Manual" -*- nroff -*-
+.TH PIDSTAT 1 "MARCH 2013" Linux "Linux User's Manual" -*- nroff -*-
.SH NAME
pidstat \- Report statistics for Linux tasks.
.SH SYNOPSIS
Report I/O statistics (kernels 2.6.20 and later only).
The following values are displayed:
-.B PID
+.B UID
+.RS
.RS
+The real user identification number of the task being monitored.
+.RE
+
+.B PID
.RS
The identification number of the task being monitored.
.RE
When reporting statistics for individual tasks,
the following values are displayed:
-.B PID
+.B UID
.RS
.RS
+The real user identification number of the task being monitored.
+.RE
+
+.B PID
+.RS
The identification number of the task being monitored.
.RE
When reporting global statistics for tasks and all their children,
the following values are displayed:
+.B UID
+.RS
+The real user identification number of the task which is being monitored
+together with its children.
+.RE
+
.B PID
.RS
The identification number of the task which is being monitored
Report stack utilization.
The following values are displayed:
-.B PID
+.B UID
.RS
.RS
+The real user identification number of the task being monitored.
+.RE
+
+.B PID
+.RS
The identification number of the task being monitored.
.RE
When reporting statistics for individual tasks,
the following values are displayed:
-.B PID
+.B UID
+.RS
.RS
+The real user identification number of the task being monitored.
+.RE
+
+.B PID
.RS
The identification number of the task being monitored.
.RE
When reporting global statistics for tasks and all their children,
the following values are displayed:
+.B UID
+.RS
+The real user identification number of the task which is being monitored
+together with its children.
+.RE
+
.B PID
.RS
The identification number of the task which is being monitored
Report task switching activity (kernels 2.6.23 and later only).
The following values are displayed:
-.B PID
+.B UID
.RS
.RS
+The real user identification number of the task being monitored.
+.RE
+
+.B PID
+.RS
The identification number of the task being monitored.
.RE
while (fgets(line, 256, fp) != NULL) {
- if (!strncmp(line, "voluntary_ctxt_switches:", 24)) {
+ if (!strncmp(line, "Uid:", 4)) {
+ sscanf(line + 5, "%d", &pst->uid);
+ }
+ else if (!strncmp(line, "voluntary_ctxt_switches:", 24)) {
sscanf(line + 25, "%lu", &pst->nvcsw);
}
else if (!strncmp(line, "nonvoluntary_ctxt_switches:", 27)) {
*/
void print_line_id(char *timestamp, struct pid_stats *pst)
{
- printf("%-11s", timestamp);
+ printf("%-11s %5d", timestamp, pst->uid);
__print_line_id(pst, '-');
}
&pstc, &pstp) <= 0)
continue;
- printf("%11ld", (long) time(NULL));
+ printf("%11ld %5d", (long) time(NULL), pstc->uid);
__print_line_id(pstc, '0');
if (DISPLAY_CPU(actflag)) {
&pstc, &pstp) <= 0)
continue;
- printf("%11ld", (long) time(NULL));
+ printf("%11ld %5d", (long) time(NULL), pstc->uid);
__print_line_id(pstc, '0');
if (DISPLAY_CPU(actflag)) {
/*
* pidstat: Display per-process statistics.
- * (C) 2007-2011 by Sebastien Godard (sysstat <at> orange.fr)
+ * (C) 2007-2013 by Sebastien Godard (sysstat <at> orange.fr)
*/
#ifndef _PIDSTAT_H
#define TASK_SMAP "/proc/%u/task/%u/smaps"
#define PRINT_ID_HDR(_timestamp_, _flag_) do { \
- printf("\n%-11s", _timestamp_); \
+ printf("\n%-11s UID", _timestamp_); \
if (DISPLAY_TID(_flag_)) { \
printf(" TGID TID"); \
} \
unsigned int uc_asum_count __attribute__ ((packed));
unsigned int processor __attribute__ ((packed));
unsigned int flags __attribute__ ((packed));
+ unsigned int uid __attribute__ ((packed));
char comm[MAX_COMM_LEN];
char cmdline[MAX_CMDLINE_LEN];
};