#define TRACE_GRAPH_PRINT_OVERRUN      0x1
 #define TRACE_GRAPH_PRINT_CPU          0x2
 #define TRACE_GRAPH_PRINT_OVERHEAD     0x4
+#define TRACE_GRAPH_PRINT_PROC         0x8
 
 static struct tracer_opt trace_opts[] = {
        /* Display overruns ? */
        { TRACER_OPT(funcgraph-cpu, TRACE_GRAPH_PRINT_CPU) },
        /* Display Overhead ? */
        { TRACER_OPT(funcgraph-overhead, TRACE_GRAPH_PRINT_OVERHEAD) },
+       /* Display proc name/pid */
+       { TRACER_OPT(funcgraph-proc, TRACE_GRAPH_PRINT_PROC) },
        { } /* Empty entry */
 };
 
 static struct tracer_flags tracer_flags = {
-       /* Don't display overruns by default */
+       /* Don't display overruns and proc by default */
        .val = TRACE_GRAPH_PRINT_CPU | TRACE_GRAPH_PRINT_OVERHEAD,
        .opts = trace_opts
 };
        return TRACE_TYPE_HANDLED;
 }
 
+#define TRACE_GRAPH_PROCINFO_LENGTH    14
+
+static enum print_line_t
+print_graph_proc(struct trace_seq *s, pid_t pid)
+{
+       int i;
+       int ret;
+       int len;
+       char comm[8];
+       int spaces = 0;
+       /* sign + log10(MAX_INT) + '\0' */
+       char pid_str[11];
+
+       strncpy(comm, trace_find_cmdline(pid), 7);
+       comm[7] = '\0';
+       sprintf(pid_str, "%d", pid);
+
+       /* 1 stands for the "-" character */
+       len = strlen(comm) + strlen(pid_str) + 1;
+
+       if (len < TRACE_GRAPH_PROCINFO_LENGTH)
+               spaces = TRACE_GRAPH_PROCINFO_LENGTH - len;
+
+       /* First spaces to align center */
+       for (i = 0; i < spaces / 2; i++) {
+               ret = trace_seq_printf(s, " ");
+               if (!ret)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       }
+
+       ret = trace_seq_printf(s, "%s-%s", comm, pid_str);
+       if (!ret)
+               return TRACE_TYPE_PARTIAL_LINE;
+
+       /* Last spaces to align center */
+       for (i = 0; i < spaces - (spaces / 2); i++) {
+               ret = trace_seq_printf(s, " ");
+               if (!ret)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       }
+       return TRACE_TYPE_HANDLED;
+}
+
 
 /* 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 enum print_line_t
+verif_pid(struct trace_seq *s, pid_t pid, int cpu)
 {
-       char *comm, *prev_comm;
        pid_t prev_pid;
        int ret;
 
        if (last_pid[cpu] != -1 && last_pid[cpu] == pid)
-               return 1;
+               return TRACE_TYPE_HANDLED;
 
        prev_pid = last_pid[cpu];
        last_pid[cpu] = pid;
 
-       comm = trace_find_cmdline(pid);
-       prev_comm = trace_find_cmdline(prev_pid);
-
 /*
  * Context-switch trace line:
 
 
  */
        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");
+               "\n ------------------------------------------\n |");
+       if (!ret)
+               TRACE_TYPE_PARTIAL_LINE;
+
+       ret = print_graph_cpu(s, cpu);
+       if (ret == TRACE_TYPE_PARTIAL_LINE)
+               TRACE_TYPE_PARTIAL_LINE;
+
+       ret = print_graph_proc(s, prev_pid);
+       if (ret == TRACE_TYPE_PARTIAL_LINE)
+               TRACE_TYPE_PARTIAL_LINE;
+
+       ret = trace_seq_printf(s, " => ");
+       if (!ret)
+               TRACE_TYPE_PARTIAL_LINE;
+
+       ret = print_graph_proc(s, pid);
+       if (ret == TRACE_TYPE_PARTIAL_LINE)
+               TRACE_TYPE_PARTIAL_LINE;
+
+       ret = trace_seq_printf(s,
+               "\n ------------------------------------------\n\n");
+       if (!ret)
+               TRACE_TYPE_PARTIAL_LINE;
+
        return ret;
 }
 
        struct trace_entry *ent = iter->ent;
 
        /* Pid */
-       if (!verif_pid(s, ent->pid, cpu))
+       if (verif_pid(s, ent->pid, cpu) == TRACE_TYPE_PARTIAL_LINE)
                return TRACE_TYPE_PARTIAL_LINE;
 
        /* Cpu */
        if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
                ret = print_graph_cpu(s, cpu);
+               if (ret == TRACE_TYPE_PARTIAL_LINE)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       }
+
+       /* Proc */
+       if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
+               ret = print_graph_proc(s, ent->pid);
+               if (ret == TRACE_TYPE_PARTIAL_LINE)
+                       return TRACE_TYPE_PARTIAL_LINE;
+
+               ret = trace_seq_printf(s, " | ");
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }
                duration = 9999999ULL;
 
        /* Pid */
-       if (!verif_pid(s, ent->pid, cpu))
+       if (verif_pid(s, ent->pid, cpu) == TRACE_TYPE_PARTIAL_LINE)
                return TRACE_TYPE_PARTIAL_LINE;
 
        /* Cpu */
        if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
                ret = print_graph_cpu(s, cpu);
+               if (ret == TRACE_TYPE_PARTIAL_LINE)
+                       return TRACE_TYPE_PARTIAL_LINE;
+       }
+
+       /* Proc */
+       if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
+               ret = print_graph_proc(s, ent->pid);
+               if (ret == TRACE_TYPE_PARTIAL_LINE)
+                       return TRACE_TYPE_PARTIAL_LINE;
+
+               ret = trace_seq_printf(s, " | ");
                if (!ret)
                        return TRACE_TYPE_PARTIAL_LINE;
        }