Commit bac524d3 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Thomas Gleixner

ftrace: trace next state

Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 88a4216c
...@@ -736,6 +736,7 @@ tracing_sched_switch_trace(struct trace_array *tr, ...@@ -736,6 +736,7 @@ tracing_sched_switch_trace(struct trace_array *tr,
entry->ctx.prev_state = prev->state; entry->ctx.prev_state = prev->state;
entry->ctx.next_pid = next->pid; entry->ctx.next_pid = next->pid;
entry->ctx.next_prio = next->prio; entry->ctx.next_prio = next->prio;
entry->ctx.next_state = next->state;
__trace_stack(tr, data, flags, 4); __trace_stack(tr, data, flags, 4);
spin_unlock_irqrestore(&data->lock, irq_flags); spin_unlock_irqrestore(&data->lock, irq_flags);
} }
...@@ -759,6 +760,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr, ...@@ -759,6 +760,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
entry->ctx.prev_state = curr->state; entry->ctx.prev_state = curr->state;
entry->ctx.next_pid = wakee->pid; entry->ctx.next_pid = wakee->pid;
entry->ctx.next_prio = wakee->prio; entry->ctx.next_prio = wakee->prio;
entry->ctx.next_state = wakee->state;
__trace_stack(tr, data, flags, 5); __trace_stack(tr, data, flags, 5);
spin_unlock_irqrestore(&data->lock, irq_flags); spin_unlock_irqrestore(&data->lock, irq_flags);
...@@ -1207,7 +1209,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) ...@@ -1207,7 +1209,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
unsigned long abs_usecs; unsigned long abs_usecs;
unsigned long rel_usecs; unsigned long rel_usecs;
char *comm; char *comm;
int S; int S, T;
int i; int i;
if (!next_entry) if (!next_entry)
...@@ -1241,14 +1243,17 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) ...@@ -1241,14 +1243,17 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
case TRACE_WAKE: case TRACE_WAKE:
S = entry->ctx.prev_state < sizeof(state_to_char) ? S = entry->ctx.prev_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.prev_state] : 'X'; state_to_char[entry->ctx.prev_state] : 'X';
T = entry->ctx.next_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.next_state] : 'X';
comm = trace_find_cmdline(entry->ctx.next_pid); comm = trace_find_cmdline(entry->ctx.next_pid);
trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d %s\n", trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c %s\n",
entry->ctx.prev_pid, entry->ctx.prev_pid,
entry->ctx.prev_prio, entry->ctx.prev_prio,
S, entry->type == TRACE_CTX ? "==>" : " +", S, entry->type == TRACE_CTX ? "==>" : " +",
entry->ctx.next_pid, entry->ctx.next_pid,
entry->ctx.next_prio, entry->ctx.next_prio,
comm); T, comm);
break; break;
case TRACE_SPECIAL: case TRACE_SPECIAL:
trace_seq_printf(s, "# %ld %ld %ld\n", trace_seq_printf(s, "# %ld %ld %ld\n",
...@@ -1280,7 +1285,7 @@ static int print_trace_fmt(struct trace_iterator *iter) ...@@ -1280,7 +1285,7 @@ static int print_trace_fmt(struct trace_iterator *iter)
unsigned long secs; unsigned long secs;
char *comm; char *comm;
int ret; int ret;
int S; int S, T;
int i; int i;
entry = iter->ent; entry = iter->ent;
...@@ -1324,13 +1329,16 @@ static int print_trace_fmt(struct trace_iterator *iter) ...@@ -1324,13 +1329,16 @@ static int print_trace_fmt(struct trace_iterator *iter)
case TRACE_WAKE: case TRACE_WAKE:
S = entry->ctx.prev_state < sizeof(state_to_char) ? S = entry->ctx.prev_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.prev_state] : 'X'; state_to_char[entry->ctx.prev_state] : 'X';
ret = trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d\n", T = entry->ctx.next_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.next_state] : 'X';
ret = trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c\n",
entry->ctx.prev_pid, entry->ctx.prev_pid,
entry->ctx.prev_prio, entry->ctx.prev_prio,
S, S,
entry->type == TRACE_CTX ? "==>" : " +", entry->type == TRACE_CTX ? "==>" : " +",
entry->ctx.next_pid, entry->ctx.next_pid,
entry->ctx.next_prio); entry->ctx.next_prio,
T);
if (!ret) if (!ret)
return 0; return 0;
break; break;
...@@ -1367,7 +1375,7 @@ static int print_raw_fmt(struct trace_iterator *iter) ...@@ -1367,7 +1375,7 @@ static int print_raw_fmt(struct trace_iterator *iter)
struct trace_seq *s = &iter->seq; struct trace_seq *s = &iter->seq;
struct trace_entry *entry; struct trace_entry *entry;
int ret; int ret;
int S; int S, T;
entry = iter->ent; entry = iter->ent;
...@@ -1387,14 +1395,17 @@ static int print_raw_fmt(struct trace_iterator *iter) ...@@ -1387,14 +1395,17 @@ static int print_raw_fmt(struct trace_iterator *iter)
case TRACE_WAKE: case TRACE_WAKE:
S = entry->ctx.prev_state < sizeof(state_to_char) ? S = entry->ctx.prev_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.prev_state] : 'X'; state_to_char[entry->ctx.prev_state] : 'X';
T = entry->ctx.next_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.next_state] : 'X';
if (entry->type == TRACE_WAKE) if (entry->type == TRACE_WAKE)
S = '+'; S = '+';
ret = trace_seq_printf(s, "%d %d %c %d %d\n", ret = trace_seq_printf(s, "%d %d %c %d %d %c\n",
entry->ctx.prev_pid, entry->ctx.prev_pid,
entry->ctx.prev_prio, entry->ctx.prev_prio,
S, S,
entry->ctx.next_pid, entry->ctx.next_pid,
entry->ctx.next_prio); entry->ctx.next_prio,
T);
if (!ret) if (!ret)
return 0; return 0;
break; break;
...@@ -1428,7 +1439,7 @@ static int print_hex_fmt(struct trace_iterator *iter) ...@@ -1428,7 +1439,7 @@ static int print_hex_fmt(struct trace_iterator *iter)
struct trace_seq *s = &iter->seq; struct trace_seq *s = &iter->seq;
unsigned char newline = '\n'; unsigned char newline = '\n';
struct trace_entry *entry; struct trace_entry *entry;
int S; int S, T;
entry = iter->ent; entry = iter->ent;
...@@ -1445,6 +1456,8 @@ static int print_hex_fmt(struct trace_iterator *iter) ...@@ -1445,6 +1456,8 @@ static int print_hex_fmt(struct trace_iterator *iter)
case TRACE_WAKE: case TRACE_WAKE:
S = entry->ctx.prev_state < sizeof(state_to_char) ? S = entry->ctx.prev_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.prev_state] : 'X'; state_to_char[entry->ctx.prev_state] : 'X';
T = entry->ctx.next_state < sizeof(state_to_char) ?
state_to_char[entry->ctx.next_state] : 'X';
if (entry->type == TRACE_WAKE) if (entry->type == TRACE_WAKE)
S = '+'; S = '+';
SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.prev_pid); SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.prev_pid);
...@@ -1453,6 +1466,7 @@ static int print_hex_fmt(struct trace_iterator *iter) ...@@ -1453,6 +1466,7 @@ static int print_hex_fmt(struct trace_iterator *iter)
SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_pid); SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_pid);
SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_prio); SEQ_PUT_HEX_FIELD_RET(s, entry->ctx.next_prio);
SEQ_PUT_HEX_FIELD_RET(s, entry->fn.parent_ip); SEQ_PUT_HEX_FIELD_RET(s, entry->fn.parent_ip);
SEQ_PUT_HEX_FIELD_RET(s, T);
break; break;
case TRACE_SPECIAL: case TRACE_SPECIAL:
case TRACE_STACK: case TRACE_STACK:
...@@ -1488,6 +1502,7 @@ static int print_bin_fmt(struct trace_iterator *iter) ...@@ -1488,6 +1502,7 @@ static int print_bin_fmt(struct trace_iterator *iter)
SEQ_PUT_FIELD_RET(s, entry->ctx.prev_state); SEQ_PUT_FIELD_RET(s, entry->ctx.prev_state);
SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid); SEQ_PUT_FIELD_RET(s, entry->ctx.next_pid);
SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio); SEQ_PUT_FIELD_RET(s, entry->ctx.next_prio);
SEQ_PUT_FIELD_RET(s, entry->ctx.next_state);
break; break;
case TRACE_SPECIAL: case TRACE_SPECIAL:
case TRACE_STACK: case TRACE_STACK:
......
...@@ -23,6 +23,7 @@ struct ctx_switch_entry { ...@@ -23,6 +23,7 @@ struct ctx_switch_entry {
unsigned char prev_state; unsigned char prev_state;
unsigned int next_pid; unsigned int next_pid;
unsigned char next_prio; unsigned char next_prio;
unsigned char next_state;
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment