aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/accounting/getdelays.c
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/accounting/getdelays.c')
-rw-r--r--Documentation/accounting/getdelays.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 93dd04f86a27..e9126e794ed7 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -48,6 +48,7 @@ int rcvbufsz;
48char name[100]; 48char name[100];
49int dbg; 49int dbg;
50int print_delays; 50int print_delays;
51int print_io_accounting;
51__u64 stime, utime; 52__u64 stime, utime;
52 53
53#define PRINTF(fmt, arg...) { \ 54#define PRINTF(fmt, arg...) { \
@@ -195,6 +196,15 @@ void print_delayacct(struct taskstats *t)
195 "count", "delay total", t->swapin_count, t->swapin_delay_total); 196 "count", "delay total", t->swapin_count, t->swapin_delay_total);
196} 197}
197 198
199void print_ioacct(struct taskstats *t)
200{
201 printf("%s: read=%llu, write=%llu, cancelled_write=%llu\n",
202 t->ac_comm,
203 (unsigned long long)t->read_bytes,
204 (unsigned long long)t->write_bytes,
205 (unsigned long long)t->cancelled_write_bytes);
206}
207
198int main(int argc, char *argv[]) 208int main(int argc, char *argv[])
199{ 209{
200 int c, rc, rep_len, aggr_len, len2, cmd_type; 210 int c, rc, rep_len, aggr_len, len2, cmd_type;
@@ -217,7 +227,7 @@ int main(int argc, char *argv[])
217 struct msgtemplate msg; 227 struct msgtemplate msg;
218 228
219 while (1) { 229 while (1) {
220 c = getopt(argc, argv, "dw:r:m:t:p:v:l"); 230 c = getopt(argc, argv, "diw:r:m:t:p:v:l");
221 if (c < 0) 231 if (c < 0)
222 break; 232 break;
223 233
@@ -226,6 +236,10 @@ int main(int argc, char *argv[])
226 printf("print delayacct stats ON\n"); 236 printf("print delayacct stats ON\n");
227 print_delays = 1; 237 print_delays = 1;
228 break; 238 break;
239 case 'i':
240 printf("printing IO accounting\n");
241 print_io_accounting = 1;
242 break;
229 case 'w': 243 case 'w':
230 strncpy(logfile, optarg, MAX_FILENAME); 244 strncpy(logfile, optarg, MAX_FILENAME);
231 printf("write to file %s\n", logfile); 245 printf("write to file %s\n", logfile);
@@ -247,14 +261,12 @@ int main(int argc, char *argv[])
247 if (!tid) 261 if (!tid)
248 err(1, "Invalid tgid\n"); 262 err(1, "Invalid tgid\n");
249 cmd_type = TASKSTATS_CMD_ATTR_TGID; 263 cmd_type = TASKSTATS_CMD_ATTR_TGID;
250 print_delays = 1;
251 break; 264 break;
252 case 'p': 265 case 'p':
253 tid = atoi(optarg); 266 tid = atoi(optarg);
254 if (!tid) 267 if (!tid)
255 err(1, "Invalid pid\n"); 268 err(1, "Invalid pid\n");
256 cmd_type = TASKSTATS_CMD_ATTR_PID; 269 cmd_type = TASKSTATS_CMD_ATTR_PID;
257 print_delays = 1;
258 break; 270 break;
259 case 'v': 271 case 'v':
260 printf("debug on\n"); 272 printf("debug on\n");
@@ -367,6 +379,8 @@ int main(int argc, char *argv[])
367 count++; 379 count++;
368 if (print_delays) 380 if (print_delays)
369 print_delayacct((struct taskstats *) NLA_DATA(na)); 381 print_delayacct((struct taskstats *) NLA_DATA(na));
382 if (print_io_accounting)
383 print_ioacct((struct taskstats *) NLA_DATA(na));
370 if (fd) { 384 if (fd) {
371 if (write(fd, NLA_DATA(na), na->nla_len) < 0) { 385 if (write(fd, NLA_DATA(na), na->nla_len) < 0) {
372 err(1,"write error\n"); 386 err(1,"write error\n");