aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2008-05-12 15:20:53 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 15:08:54 -0400
commitbac524d3f3dfeffa3a9d44f2c64035b88bcaacb4 (patch)
tree467645f4b40dcd4aa8f37f0f601ffc7b07048273 /kernel
parent88a4216c3ec4281fc7e6725cc3a3ccd01fb1aa14 (diff)
ftrace: trace next state
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c35
-rw-r--r--kernel/trace/trace.h1
2 files changed, 26 insertions, 10 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b87a26414892..b63fe909f87b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -736,6 +736,7 @@ tracing_sched_switch_trace(struct trace_array *tr,
736 entry->ctx.prev_state = prev->state; 736 entry->ctx.prev_state = prev->state;
737 entry->ctx.next_pid = next->pid; 737 entry->ctx.next_pid = next->pid;
738 entry->ctx.next_prio = next->prio; 738 entry->ctx.next_prio = next->prio;
739 entry->ctx.next_state = next->state;
739 __trace_stack(tr, data, flags, 4); 740 __trace_stack(tr, data, flags, 4);
740 spin_unlock_irqrestore(&data->lock, irq_flags); 741 spin_unlock_irqrestore(&data->lock, irq_flags);
741} 742}
@@ -759,6 +760,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
759 entry->ctx.prev_state = curr->state; 760 entry->ctx.prev_state = curr->state;
760 entry->ctx.next_pid = wakee->pid; 761 entry->ctx.next_pid = wakee->pid;
761 entry->ctx.next_prio = wakee->prio; 762 entry->ctx.next_prio = wakee->prio;
763 entry->ctx.next_state = wakee->state;
762 __trace_stack(tr, data, flags, 5); 764 __trace_stack(tr, data, flags, 5);
763 spin_unlock_irqrestore(&data->lock, irq_flags); 765 spin_unlock_irqrestore(&data->lock, irq_flags);
764 766
@@ -1207,7 +1209,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1207 unsigned long abs_usecs; 1209 unsigned long abs_usecs;
1208 unsigned long rel_usecs; 1210 unsigned long rel_usecs;
1209 char *comm; 1211 char *comm;
1210 int S; 1212 int S, T;
1211 int i; 1213 int i;
1212 1214
1213 if (!next_entry) 1215 if (!next_entry)
@@ -1241,14 +1243,17 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1241 case TRACE_WAKE: 1243 case TRACE_WAKE:
1242 S = entry->ctx.prev_state < sizeof(state_to_char) ? 1244 S = entry->ctx.prev_state < sizeof(state_to_char) ?
1243 state_to_char[entry->ctx.prev_state] : 'X'; 1245 state_to_char[entry->ctx.prev_state] : 'X';
1246 T = entry->ctx.next_state < sizeof(state_to_char) ?
1247 state_to_char[entry->ctx.next_state] : 'X';
1248
1244 comm = trace_find_cmdline(entry->ctx.next_pid); 1249 comm = trace_find_cmdline(entry->ctx.next_pid);
1245 trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d %s\n", 1250 trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c %s\n",
1246 entry->ctx.prev_pid, 1251 entry->ctx.prev_pid,
1247 entry->ctx.prev_prio, 1252 entry->ctx.prev_prio,
1248 S, entry->type == TRACE_CTX ? "==>" : " +", 1253 S, entry->type == TRACE_CTX ? "==>" : " +",
1249 entry->ctx.next_pid, 1254 entry->ctx.next_pid,
1250 entry->ctx.next_prio, 1255 entry->ctx.next_prio,
1251 comm); 1256 T, comm);
1252 break; 1257 break;
1253 case TRACE_SPECIAL: 1258 case TRACE_SPECIAL:
1254 trace_seq_printf(s, "# %ld %ld %ld\n", 1259 trace_seq_printf(s, "# %ld %ld %ld\n",
@@ -1280,7 +1285,7 @@ static int print_trace_fmt(struct trace_iterator *iter)
1280 unsigned long secs; 1285 unsigned long secs;
1281 char *comm; 1286 char *comm;
1282 int ret; 1287 int ret;
1283 int S; 1288 int S, T;
1284 int i; 1289 int i;
1285 1290
1286 entry = iter->ent; 1291 entry = iter->ent;
@@ -1324,13 +1329,16 @@ static int print_trace_fmt(struct trace_iterator *iter)
1324 case TRACE_WAKE: 1329 case TRACE_WAKE:
1325 S = entry->ctx.prev_state < sizeof(state_to_char) ? 1330 S = entry->ctx.prev_state < sizeof(state_to_char) ?
1326 state_to_char[entry->ctx.prev_state] : 'X'; 1331 state_to_char[entry->ctx.prev_state] : 'X';
1327 ret = trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d\n", 1332 T = entry->ctx.next_state < sizeof(state_to_char) ?
1333 state_to_char[entry->ctx.next_state] : 'X';
1334 ret = trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c\n",
1328 entry->ctx.prev_pid, 1335 entry->ctx.prev_pid,
1329 entry->ctx.prev_prio, 1336 entry->ctx.prev_prio,
1330 S, 1337 S,
1331 entry->type == TRACE_CTX ? "==>" : " +", 1338 entry->type == TRACE_CTX ? "==>" : " +",
1332 entry->ctx.next_pid, 1339 entry->ctx.next_pid,
1333 entry->ctx.next_prio); 1340 entry->ctx.next_prio,
1341 T);
1334 if (!ret) 1342 if (!ret)
1335 return 0; 1343 return 0;
1336 break; 1344 break;
@@ -1367,7 +1375,7 @@ static int print_raw_fmt(struct trace_iterator *iter)
1367 struct trace_seq *s = &iter->seq; 1375 struct trace_seq *s = &iter->seq;
1368 struct trace_entry *entry; 1376 struct trace_entry *entry;
1369 int ret; 1377 int ret;
1370 int S; 1378 int S, T;
1371 1379
1372 entry = iter->ent; 1380 entry = iter->ent;
1373 1381
@@ -1387,14 +1395,17 @@ static int print_raw_fmt(struct trace_iterator *iter)
1387 case TRACE_WAKE: 1395 case TRACE_WAKE:
1388 S = entry->ctx.prev_state < sizeof(state_to_char) ? 1396 S = entry->ctx.prev_state < sizeof(state_to_char) ?
1389 state_to_char[entry->ctx.prev_state] : 'X'; 1397 state_to_char[entry->ctx.prev_state] : 'X';
1398 T = entry->ctx.next_state < sizeof(state_to_char) ?
1399 state_to_char[entry->ctx.next_state] : 'X';
1390 if (entry->type == TRACE_WAKE) 1400 if (entry->type == TRACE_WAKE)
1391 S = '+'; 1401 S = '+';
1392 ret = trace_seq_printf(s, "%d %d %c %d %d\n", 1402 ret = trace_seq_printf(s, "%d %d %c %d %d %c\n",
1393 entry->ctx.prev_pid, 1403 entry->ctx.prev_pid,
1394 entry->ctx.prev_prio, 1404 entry->ctx.prev_prio,
1395 S, 1405 S,
1396 entry->ctx.next_pid, 1406 entry->ctx.next_pid,
1397 entry->ctx.next_prio); 1407 entry->ctx.next_prio,
1408 T);
1398 if (!ret) 1409 if (!ret)
1399 return 0; 1410 return 0;
1400 break; 1411 break;
@@ -1428,7 +1439,7 @@ static int print_hex_fmt(struct trace_iterator *iter)
1428 struct trace_seq *s = &iter->seq; 1439 struct trace_seq *s = &iter->seq;
1429 unsigned char newline = '\n'; 1440 unsigned char newline = '\n';
1430 struct trace_entry *entry; 1441 struct trace_entry *entry;
1431 int S; 1442 int S, T;
1432 1443
1433 entry = iter->ent; 1444 entry = iter->ent;
1434 1445
@@ -1445,6 +1456,8 @@ static int print_hex_fmt(struct trace_iterator *iter)
1445 case TRACE_WAKE: 1456 case TRACE_WAKE:
1446 S = entry->ctx.prev_state < sizeof(state_to_char) ? 1457 S = entry->ctx.prev_state < sizeof(state_to_char) ?
1447 state_to_char[entry->ctx.prev_state] : 'X'; 1458 state_to_char[entry->ctx.prev_state] : 'X';
1459 T = entry->ctx.next_state < sizeof(state_to_char) ?
1460 state_to_char[entry->ctx.next_state] : 'X';
1448 if (entry->type == TRACE_WAKE) 1461 if (entry->type == TRACE_WAKE)
1449 S = '+'; 1462 S = '+';
1450 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.prev_pid); 1463 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.prev_pid);
@@ -1453,6 +1466,7 @@ static int print_hex_fmt(struct trace_iterator *iter)
1453 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_pid); 1466 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_pid);
1454 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_prio); 1467 SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_prio);
1455 SEQ_PUT_HEX_FIELD_RET(s, entry->fn.parent_ip); 1468 SEQ_PUT_HEX_FIELD_RET(s, entry->fn.parent_ip);
1469 SEQ_PUT_HEX_FIELD_RET(s, T);
1456 break; 1470 break;
1457 case TRACE_SPECIAL: 1471 case TRACE_SPECIAL:
1458 case TRACE_STACK: 1472 case TRACE_STACK:
@@ -1488,6 +1502,7 @@ static int print_bin_fmt(struct trace_iterator *iter)
1488 SEQ_PUT_FIELD_RET(s, entry->ctx.prev_state); 1502 SEQ_PUT_FIELD_RET(s, entry->ctx.prev_state);
1489 SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); 1503 SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid);
1490 SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); 1504 SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio);
1505 SEQ_PUT_FIELD_RET(s, entry->ctx.next_state);
1491 break; 1506 break;
1492 case TRACE_SPECIAL: 1507 case TRACE_SPECIAL:
1493 case TRACE_STACK: 1508 case TRACE_STACK:
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index a52015702a28..96951a8d09a4 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -23,6 +23,7 @@ struct ctx_switch_entry {
23 unsigned char prev_state; 23 unsigned char prev_state;
24 unsigned int next_pid; 24 unsigned int next_pid;
25 unsigned char next_prio; 25 unsigned char next_prio;
26 unsigned char next_state;
26}; 27};
27 28
28/* 29/*