aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2008-09-04 04:24:16 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-14 04:36:48 -0400
commit80b5e940050c273ba277acbf3a9fbc1d4441e681 (patch)
treedd40f96b91fe3dc5508395cf9a559e14070499e7 /kernel
parentf09ce573f57ddc35c67b39e51f34545877b30031 (diff)
ftrace: sched_switch: show the wakee's cpu
While profiling the smp behaviour of the scheduler it was needed to know to which cpu a task got woken. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.c12
-rw-r--r--kernel/trace/trace.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8a00d6c5c0f5..7e6cb4fe62f2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -977,6 +977,7 @@ tracing_sched_switch_trace(struct trace_array *tr,
977 entry->field.ctx.next_pid = next->pid; 977 entry->field.ctx.next_pid = next->pid;
978 entry->field.ctx.next_prio = next->prio; 978 entry->field.ctx.next_prio = next->prio;
979 entry->field.ctx.next_state = next->state; 979 entry->field.ctx.next_state = next->state;
980 entry->field.ctx.next_cpu = task_cpu(next);
980 __trace_stack(tr, data, flags, 5); 981 __trace_stack(tr, data, flags, 5);
981 __raw_spin_unlock(&data->lock); 982 __raw_spin_unlock(&data->lock);
982 raw_local_irq_restore(irq_flags); 983 raw_local_irq_restore(irq_flags);
@@ -1003,6 +1004,7 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
1003 entry->field.ctx.next_pid = wakee->pid; 1004 entry->field.ctx.next_pid = wakee->pid;
1004 entry->field.ctx.next_prio = wakee->prio; 1005 entry->field.ctx.next_prio = wakee->prio;
1005 entry->field.ctx.next_state = wakee->state; 1006 entry->field.ctx.next_state = wakee->state;
1007 entry->field.ctx.next_cpu = task_cpu(wakee);
1006 __trace_stack(tr, data, flags, 6); 1008 __trace_stack(tr, data, flags, 6);
1007 __raw_spin_unlock(&data->lock); 1009 __raw_spin_unlock(&data->lock);
1008 raw_local_irq_restore(irq_flags); 1010 raw_local_irq_restore(irq_flags);
@@ -1636,10 +1638,11 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu)
1636 __ffs(field->ctx.prev_state) + 1 : 0; 1638 __ffs(field->ctx.prev_state) + 1 : 0;
1637 S = state < sizeof(state_to_char) - 1 ? state_to_char[state] : 'X'; 1639 S = state < sizeof(state_to_char) - 1 ? state_to_char[state] : 'X';
1638 comm = trace_find_cmdline(field->ctx.next_pid); 1640 comm = trace_find_cmdline(field->ctx.next_pid);
1639 trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c %s\n", 1641 trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
1640 field->ctx.prev_pid, 1642 field->ctx.prev_pid,
1641 field->ctx.prev_prio, 1643 field->ctx.prev_prio,
1642 S, entry->type == TRACE_CTX ? "==>" : " +", 1644 S, entry->type == TRACE_CTX ? "==>" : " +",
1645 field->ctx.next_cpu,
1643 field->ctx.next_pid, 1646 field->ctx.next_pid,
1644 field->ctx.next_prio, 1647 field->ctx.next_prio,
1645 T, comm); 1648 T, comm);
@@ -1736,11 +1739,12 @@ static int print_trace_fmt(struct trace_iterator *iter)
1736 state_to_char[field->ctx.prev_state] : 'X'; 1739 state_to_char[field->ctx.prev_state] : 'X';
1737 T = field->ctx.next_state < sizeof(state_to_char) ? 1740 T = field->ctx.next_state < sizeof(state_to_char) ?
1738 state_to_char[field->ctx.next_state] : 'X'; 1741 state_to_char[field->ctx.next_state] : 'X';
1739 ret = trace_seq_printf(s, " %5d:%3d:%c %s %5d:%3d:%c\n", 1742 ret = trace_seq_printf(s, " %5d:%3d:%c %s [%03d] %5d:%3d:%c\n",
1740 field->ctx.prev_pid, 1743 field->ctx.prev_pid,
1741 field->ctx.prev_prio, 1744 field->ctx.prev_prio,
1742 S, 1745 S,
1743 entry->type == TRACE_CTX ? "==>" : " +", 1746 entry->type == TRACE_CTX ? "==>" : " +",
1747 field->ctx.next_cpu,
1744 field->ctx.next_pid, 1748 field->ctx.next_pid,
1745 field->ctx.next_prio, 1749 field->ctx.next_prio,
1746 T); 1750 T);
@@ -1817,10 +1821,11 @@ static int print_raw_fmt(struct trace_iterator *iter)
1817 state_to_char[field->ctx.next_state] : 'X'; 1821 state_to_char[field->ctx.next_state] : 'X';
1818 if (entry->type == TRACE_WAKE) 1822 if (entry->type == TRACE_WAKE)
1819 S = '+'; 1823 S = '+';
1820 ret = trace_seq_printf(s, "%d %d %c %d %d %c\n", 1824 ret = trace_seq_printf(s, "%d %d %c %d %d %d %c\n",
1821 field->ctx.prev_pid, 1825 field->ctx.prev_pid,
1822 field->ctx.prev_prio, 1826 field->ctx.prev_prio,
1823 S, 1827 S,
1828 field->ctx.next_cpu,
1824 field->ctx.next_pid, 1829 field->ctx.next_pid,
1825 field->ctx.next_prio, 1830 field->ctx.next_prio,
1826 T); 1831 T);
@@ -1893,6 +1898,7 @@ static int print_hex_fmt(struct trace_iterator *iter)
1893 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.prev_pid); 1898 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.prev_pid);
1894 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.prev_prio); 1899 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.prev_prio);
1895 SEQ_PUT_HEX_FIELD_RET(s, S); 1900 SEQ_PUT_HEX_FIELD_RET(s, S);
1901 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.next_cpu);
1896 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.next_pid); 1902 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.next_pid);
1897 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.next_prio); 1903 SEQ_PUT_HEX_FIELD_RET(s, field->ctx.next_prio);
1898 SEQ_PUT_HEX_FIELD_RET(s, T); 1904 SEQ_PUT_HEX_FIELD_RET(s, T);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 5f54c875c8be..77c265f6a779 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -41,6 +41,7 @@ struct ctx_switch_entry {
41 unsigned int next_pid; 41 unsigned int next_pid;
42 unsigned char next_prio; 42 unsigned char next_prio;
43 unsigned char next_state; 43 unsigned char next_state;
44 unsigned int next_cpu;
44}; 45};
45 46
46/* 47/*