aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorAnkita Garg <ankita@in.ibm.com>2008-05-12 15:20:58 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 15:46:30 -0400
commitd17d969160c18b631a19c2b34d260691402650f8 (patch)
tree7be3269a644d164021d1e57effe3b1f57b3adb7a /kernel/trace/trace.c
parent72829bc3d63cdc592d8f7dd86ad3b3fe8900fb74 (diff)
ftrace: fix conversion of task state to char in latency tracer
The conversion of task states to a character in the sched_switch tracer (part of latency tracer infrastructure), seems to be incorrect. We currently do it by indexing into the state_to_char array using the state value. The state values do not map directly into the array index and are thus incorrect. The following patch addresses this issue. This is also what is being done even in the show_task() routine in kernel/sched.c The patch has been compile and run tested. Signed-off-by: Ankita Garg <ankita@in.ibm.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0eef0503febd..9197782d15c9 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1208,6 +1208,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1208 char *comm; 1208 char *comm;
1209 int S, T; 1209 int S, T;
1210 int i; 1210 int i;
1211 unsigned state;
1211 1212
1212 if (!next_entry) 1213 if (!next_entry)
1213 next_entry = entry; 1214 next_entry = entry;
@@ -1238,11 +1239,11 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1238 break; 1239 break;
1239 case TRACE_CTX: 1240 case TRACE_CTX:
1240 case TRACE_WAKE: 1241 case TRACE_WAKE:
1241 S = entry->ctx.prev_state < sizeof(state_to_char) ?
1242 state_to_char[entry->ctx.prev_state] : 'X';
1243 T = entry->ctx.next_state < sizeof(state_to_char) ? 1242 T = entry->ctx.next_state < sizeof(state_to_char) ?
1244 state_to_char[entry->ctx.next_state] : 'X'; 1243 state_to_char[entry->ctx.next_state] : 'X';
1245 1244
1245 state = entry->ctx.prev_state ? __ffs(entry->ctx.prev_state) + 1 : 0;
1246 S = state < sizeof(state_to_char) - 1 ? state_to_char[state] : 'X';
1246 comm = trace_find_cmdline(entry->ctx.next_pid); 1247 comm = trace_find_cmdline(entry->ctx.next_pid);
1247 trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c %s\n", 1248 trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c %s\n",
1248 entry->ctx.prev_pid, 1249 entry->ctx.prev_pid,