aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/accounting/getdelays.c19
-rw-r--r--Documentation/accounting/taskstats-struct.txt6
2 files changed, 23 insertions, 2 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 71acc28ed0d1..24c5aade8998 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -49,6 +49,7 @@ char name[100];
49int dbg; 49int dbg;
50int print_delays; 50int print_delays;
51int print_io_accounting; 51int print_io_accounting;
52int print_task_context_switch_counts;
52__u64 stime, utime; 53__u64 stime, utime;
53 54
54#define PRINTF(fmt, arg...) { \ 55#define PRINTF(fmt, arg...) { \
@@ -195,7 +196,7 @@ void print_delayacct(struct taskstats *t)
195 "IO %15s%15s\n" 196 "IO %15s%15s\n"
196 " %15llu%15llu\n" 197 " %15llu%15llu\n"
197 "MEM %15s%15s\n" 198 "MEM %15s%15s\n"
198 " %15llu%15llu\n\n", 199 " %15llu%15llu\n"
199 "count", "real total", "virtual total", "delay total", 200 "count", "real total", "virtual total", "delay total",
200 t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, 201 t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total,
201 t->cpu_delay_total, 202 t->cpu_delay_total,
@@ -204,6 +205,14 @@ void print_delayacct(struct taskstats *t)
204 "count", "delay total", t->swapin_count, t->swapin_delay_total); 205 "count", "delay total", t->swapin_count, t->swapin_delay_total);
205} 206}
206 207
208void task_context_switch_counts(struct taskstats *t)
209{
210 printf("\n\nTask %15s%15s\n"
211 " %15lu%15lu\n",
212 "voluntary", "nonvoluntary",
213 t->nvcsw, t->nivcsw);
214}
215
207void print_ioacct(struct taskstats *t) 216void print_ioacct(struct taskstats *t)
208{ 217{
209 printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n", 218 printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
@@ -235,7 +244,7 @@ int main(int argc, char *argv[])
235 struct msgtemplate msg; 244 struct msgtemplate msg;
236 245
237 while (1) { 246 while (1) {
238 c = getopt(argc, argv, "diw:r:m:t:p:vl"); 247 c = getopt(argc, argv, "qdiw:r:m:t:p:vl");
239 if (c < 0) 248 if (c < 0)
240 break; 249 break;
241 250
@@ -248,6 +257,10 @@ int main(int argc, char *argv[])
248 printf("printing IO accounting\n"); 257 printf("printing IO accounting\n");
249 print_io_accounting = 1; 258 print_io_accounting = 1;
250 break; 259 break;
260 case 'q':
261 printf("printing task/process context switch rates\n");
262 print_task_context_switch_counts = 1;
263 break;
251 case 'w': 264 case 'w':
252 logfile = strdup(optarg); 265 logfile = strdup(optarg);
253 printf("write to file %s\n", logfile); 266 printf("write to file %s\n", logfile);
@@ -389,6 +402,8 @@ int main(int argc, char *argv[])
389 print_delayacct((struct taskstats *) NLA_DATA(na)); 402 print_delayacct((struct taskstats *) NLA_DATA(na));
390 if (print_io_accounting) 403 if (print_io_accounting)
391 print_ioacct((struct taskstats *) NLA_DATA(na)); 404 print_ioacct((struct taskstats *) NLA_DATA(na));
405 if (print_task_context_switch_counts)
406 task_context_switch_counts((struct taskstats *) NLA_DATA(na));
392 if (fd) { 407 if (fd) {
393 if (write(fd, NLA_DATA(na), na->nla_len) < 0) { 408 if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
394 err(1,"write error\n"); 409 err(1,"write error\n");
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt
index 661c797eaf79..8aa7529f8258 100644
--- a/Documentation/accounting/taskstats-struct.txt
+++ b/Documentation/accounting/taskstats-struct.txt
@@ -22,6 +22,8 @@ There are three different groups of fields in the struct taskstats:
22 /* Extended accounting fields end */ 22 /* Extended accounting fields end */
23 Their values are collected if CONFIG_TASK_XACCT is set. 23 Their values are collected if CONFIG_TASK_XACCT is set.
24 24
254) Per-task and per-thread context switch count statistics
26
25Future extension should add fields to the end of the taskstats struct, and 27Future extension should add fields to the end of the taskstats struct, and
26should not change the relative position of each field within the struct. 28should not change the relative position of each field within the struct.
27 29
@@ -158,4 +160,8 @@ struct taskstats {
158 160
159 /* Extended accounting fields end */ 161 /* Extended accounting fields end */
160 162
1634) Per-task and per-thread statistics
164 __u64 nvcsw; /* Context voluntary switch counter */
165 __u64 nivcsw; /* Context involuntary switch counter */
166
161} 167}