Commit d51090b3 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent 1a056155
...@@ -79,6 +79,19 @@ print_graph_cpu(struct trace_seq *s, int cpu) ...@@ -79,6 +79,19 @@ print_graph_cpu(struct trace_seq *s, int cpu)
int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map)); int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map));
/*
* Start with a space character - to make it stand out
* to the right a bit when trace output is pasted into
* email:
*/
ret = trace_seq_printf(s, " ");
/*
* Tricky - we space the CPU field according to the max
* number of online CPUs. On a 2-cpu system it would take
* a maximum of 1 digit - on a 128 cpu system it would
* take up to 3 digits:
*/
for (i = 0; i < log10_all - log10_this; i++) { for (i = 0; i < log10_all - log10_this; i++) {
ret = trace_seq_printf(s, " "); ret = trace_seq_printf(s, " ");
if (!ret) if (!ret)
...@@ -87,6 +100,7 @@ print_graph_cpu(struct trace_seq *s, int cpu) ...@@ -87,6 +100,7 @@ print_graph_cpu(struct trace_seq *s, int cpu)
ret = trace_seq_printf(s, "%d) ", cpu); ret = trace_seq_printf(s, "%d) ", cpu);
if (!ret) if (!ret)
return TRACE_TYPE_PARTIAL_LINE; return TRACE_TYPE_PARTIAL_LINE;
return TRACE_TYPE_HANDLED; return TRACE_TYPE_HANDLED;
} }
...@@ -94,17 +108,34 @@ print_graph_cpu(struct trace_seq *s, int cpu) ...@@ -94,17 +108,34 @@ print_graph_cpu(struct trace_seq *s, int cpu)
/* If the pid changed since the last trace, output this event */ /* If the pid changed since the last trace, output this event */
static int verif_pid(struct trace_seq *s, pid_t pid, int cpu) static int verif_pid(struct trace_seq *s, pid_t pid, int cpu)
{ {
char *comm; char *comm, *prev_comm;
pid_t prev_pid;
int ret;
if (last_pid[cpu] != -1 && last_pid[cpu] == pid) if (last_pid[cpu] != -1 && last_pid[cpu] == pid)
return 1; return 1;
prev_pid = last_pid[cpu];
last_pid[cpu] = pid; last_pid[cpu] = pid;
comm = trace_find_cmdline(pid); comm = trace_find_cmdline(pid);
prev_comm = trace_find_cmdline(prev_pid);
/*
* Context-switch trace line:
return trace_seq_printf(s, "\n------------8<---------- thread %s-%d" ------------------------------------------
" ------------8<----------\n\n", | 1) migration/0--1 => sshd-1755
cpu, comm, pid); ------------------------------------------
*/
ret = trace_seq_printf(s,
" ------------------------------------------\n");
ret += trace_seq_printf(s, " | %d) %s-%d => %s-%d\n",
cpu, prev_comm, prev_pid, comm, pid);
ret += trace_seq_printf(s,
" ------------------------------------------\n\n");
return ret;
} }
static bool static bool
......
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