diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-28 03:55:16 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-28 04:15:06 -0500 |
commit | d51090b34602a20984ab0312ef04e47069c0aec6 (patch) | |
tree | 5b7907272ceff4d57ec346d630a279dd0dec8d2d /kernel/trace/trace_functions_graph.c | |
parent | 1a056155edd458eb93ef383fa8e5741d7e7c6360 (diff) |
tracing/function-graph-tracer: more output tweaks
Impact: prettify the output some more
Before:
0) | sys_read() {
0) 0.796 us | fget_light();
0) | vfs_read() {
0) | rw_verify_area() {
0) | security_file_permission() {
------------8<---------- thread sshd-1755 ------------8<----------
After:
0) | sys_read() {
0) 0.796 us | fget_light();
0) | vfs_read() {
0) | rw_verify_area() {
0) | security_file_permission() {
------------------------------------------
| 1) migration/0--1 => sshd-1755
------------------------------------------
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 596a3ee43053..894b50bca313 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -79,6 +79,19 @@ print_graph_cpu(struct trace_seq *s, int cpu) | |||
79 | int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map)); | 79 | int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map)); |
80 | 80 | ||
81 | 81 | ||
82 | /* | ||
83 | * Start with a space character - to make it stand out | ||
84 | * to the right a bit when trace output is pasted into | ||
85 | * email: | ||
86 | */ | ||
87 | ret = trace_seq_printf(s, " "); | ||
88 | |||
89 | /* | ||
90 | * Tricky - we space the CPU field according to the max | ||
91 | * number of online CPUs. On a 2-cpu system it would take | ||
92 | * a maximum of 1 digit - on a 128 cpu system it would | ||
93 | * take up to 3 digits: | ||
94 | */ | ||
82 | for (i = 0; i < log10_all - log10_this; i++) { | 95 | for (i = 0; i < log10_all - log10_this; i++) { |
83 | ret = trace_seq_printf(s, " "); | 96 | ret = trace_seq_printf(s, " "); |
84 | if (!ret) | 97 | if (!ret) |
@@ -86,7 +99,8 @@ print_graph_cpu(struct trace_seq *s, int cpu) | |||
86 | } | 99 | } |
87 | ret = trace_seq_printf(s, "%d) ", cpu); | 100 | ret = trace_seq_printf(s, "%d) ", cpu); |
88 | if (!ret) | 101 | if (!ret) |
89 | return TRACE_TYPE_PARTIAL_LINE; | 102 | return TRACE_TYPE_PARTIAL_LINE; |
103 | |||
90 | return TRACE_TYPE_HANDLED; | 104 | return TRACE_TYPE_HANDLED; |
91 | } | 105 | } |
92 | 106 | ||
@@ -94,17 +108,34 @@ print_graph_cpu(struct trace_seq *s, int cpu) | |||
94 | /* If the pid changed since the last trace, output this event */ | 108 | /* If the pid changed since the last trace, output this event */ |
95 | static int verif_pid(struct trace_seq *s, pid_t pid, int cpu) | 109 | static int verif_pid(struct trace_seq *s, pid_t pid, int cpu) |
96 | { | 110 | { |
97 | char *comm; | 111 | char *comm, *prev_comm; |
112 | pid_t prev_pid; | ||
113 | int ret; | ||
98 | 114 | ||
99 | if (last_pid[cpu] != -1 && last_pid[cpu] == pid) | 115 | if (last_pid[cpu] != -1 && last_pid[cpu] == pid) |
100 | return 1; | 116 | return 1; |
101 | 117 | ||
118 | prev_pid = last_pid[cpu]; | ||
102 | last_pid[cpu] = pid; | 119 | last_pid[cpu] = pid; |
120 | |||
103 | comm = trace_find_cmdline(pid); | 121 | comm = trace_find_cmdline(pid); |
122 | prev_comm = trace_find_cmdline(prev_pid); | ||
104 | 123 | ||
105 | return trace_seq_printf(s, "\n------------8<---------- thread %s-%d" | 124 | /* |
106 | " ------------8<----------\n\n", | 125 | * Context-switch trace line: |
107 | cpu, comm, pid); | 126 | |
127 | ------------------------------------------ | ||
128 | | 1) migration/0--1 => sshd-1755 | ||
129 | ------------------------------------------ | ||
130 | |||
131 | */ | ||
132 | ret = trace_seq_printf(s, | ||
133 | " ------------------------------------------\n"); | ||
134 | ret += trace_seq_printf(s, " | %d) %s-%d => %s-%d\n", | ||
135 | cpu, prev_comm, prev_pid, comm, pid); | ||
136 | ret += trace_seq_printf(s, | ||
137 | " ------------------------------------------\n\n"); | ||
138 | return ret; | ||
108 | } | 139 | } |
109 | 140 | ||
110 | static bool | 141 | static bool |
@@ -142,7 +173,7 @@ static inline int | |||
142 | print_graph_duration(unsigned long long duration, struct trace_seq *s) | 173 | print_graph_duration(unsigned long long duration, struct trace_seq *s) |
143 | { | 174 | { |
144 | unsigned long nsecs_rem = do_div(duration, 1000); | 175 | unsigned long nsecs_rem = do_div(duration, 1000); |
145 | return trace_seq_printf(s, "%4llu.%3lu us | ", duration, nsecs_rem); | 176 | return trace_seq_printf(s, "%4llu.%3lu us | ", duration, nsecs_rem); |
146 | } | 177 | } |
147 | 178 | ||
148 | /* Signal a overhead of time execution to the output */ | 179 | /* Signal a overhead of time execution to the output */ |
@@ -229,7 +260,7 @@ print_graph_entry_nested(struct ftrace_graph_ent_entry *entry, | |||
229 | } | 260 | } |
230 | 261 | ||
231 | /* No time */ | 262 | /* No time */ |
232 | ret = trace_seq_printf(s, " | "); | 263 | ret = trace_seq_printf(s, " | "); |
233 | 264 | ||
234 | /* Function */ | 265 | /* Function */ |
235 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { | 266 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { |