3 * Function graph tracer.
4 * Copyright (c) 2008-2009 Frederic Weisbecker <fweisbec@gmail.com>
5 * Mostly borrowed from function tracer which
6 * is Copyright (c) Steven Rostedt <srostedt@redhat.com>
9 #include <linux/debugfs.h>
10 #include <linux/uaccess.h>
11 #include <linux/ftrace.h>
15 #include "trace_output.h"
22 #define TRACE_GRAPH_INDENT 2
25 #define TRACE_GRAPH_PRINT_OVERRUN 0x1
26 #define TRACE_GRAPH_PRINT_CPU 0x2
27 #define TRACE_GRAPH_PRINT_OVERHEAD 0x4
28 #define TRACE_GRAPH_PRINT_PROC 0x8
29 #define TRACE_GRAPH_PRINT_DURATION 0x10
30 #define TRACE_GRAPH_PRINT_ABS_TIME 0X20
32 static struct tracer_opt trace_opts[] = {
33 /* Display overruns? (for self-debug purpose) */
34 { TRACER_OPT(funcgraph-overrun, TRACE_GRAPH_PRINT_OVERRUN) },
36 { TRACER_OPT(funcgraph-cpu, TRACE_GRAPH_PRINT_CPU) },
37 /* Display Overhead ? */
38 { TRACER_OPT(funcgraph-overhead, TRACE_GRAPH_PRINT_OVERHEAD) },
39 /* Display proc name/pid */
40 { TRACER_OPT(funcgraph-proc, TRACE_GRAPH_PRINT_PROC) },
41 /* Display duration of execution */
42 { TRACER_OPT(funcgraph-duration, TRACE_GRAPH_PRINT_DURATION) },
43 /* Display absolute time of an entry */
44 { TRACER_OPT(funcgraph-abstime, TRACE_GRAPH_PRINT_ABS_TIME) },
48 static struct tracer_flags tracer_flags = {
49 /* Don't display overruns and proc by default */
50 .val = TRACE_GRAPH_PRINT_CPU | TRACE_GRAPH_PRINT_OVERHEAD |
51 TRACE_GRAPH_PRINT_DURATION,
55 /* pid on the last trace processed */
58 /* Add a function return address to the trace stack on thread info.*/
60 ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
61 unsigned long frame_pointer)
63 unsigned long long calltime;
66 if (!current->ret_stack)
70 * We must make sure the ret_stack is tested before we read
75 /* The return trace stack is full */
76 if (current->curr_ret_stack == FTRACE_RETFUNC_DEPTH - 1) {
77 atomic_inc(¤t->trace_overrun);
81 calltime = trace_clock_local();
83 index = ++current->curr_ret_stack;
85 current->ret_stack[index].ret = ret;
86 current->ret_stack[index].func = func;
87 current->ret_stack[index].calltime = calltime;
88 current->ret_stack[index].subtime = 0;
89 current->ret_stack[index].fp = frame_pointer;
95 /* Retrieve a function return address to the trace stack on thread info.*/
97 ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret,
98 unsigned long frame_pointer)
102 index = current->curr_ret_stack;
104 if (unlikely(index < 0)) {
107 /* Might as well panic, otherwise we have no where to go */
108 *ret = (unsigned long)panic;
112 #ifdef CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST
114 * The arch may choose to record the frame pointer used
115 * and check it here to make sure that it is what we expect it
116 * to be. If gcc does not set the place holder of the return
117 * address in the frame pointer, and does a copy instead, then
118 * the function graph trace will fail. This test detects this
121 * Currently, x86_32 with optimize for size (-Os) makes the latest
124 if (unlikely(current->ret_stack[index].fp != frame_pointer)) {
126 WARN(1, "Bad frame pointer: expected %lx, received %lx\n"
127 " from func %pF return to %lx\n",
128 current->ret_stack[index].fp,
130 (void *)current->ret_stack[index].func,
131 current->ret_stack[index].ret);
132 *ret = (unsigned long)panic;
137 *ret = current->ret_stack[index].ret;
138 trace->func = current->ret_stack[index].func;
139 trace->calltime = current->ret_stack[index].calltime;
140 trace->overrun = atomic_read(¤t->trace_overrun);
141 trace->depth = index;
145 * Send the trace to the ring-buffer.
146 * @return the original return address.
148 unsigned long ftrace_return_to_handler(unsigned long frame_pointer)
150 struct ftrace_graph_ret trace;
153 ftrace_pop_return_trace(&trace, &ret, frame_pointer);
154 trace.rettime = trace_clock_local();
155 ftrace_graph_return(&trace);
157 current->curr_ret_stack--;
159 if (unlikely(!ret)) {
162 /* Might as well panic. What else to do? */
163 ret = (unsigned long)panic;
169 static int graph_trace_init(struct trace_array *tr)
171 int ret = register_ftrace_graph(&trace_graph_return,
175 tracing_start_cmdline_record();
180 static void graph_trace_reset(struct trace_array *tr)
182 tracing_stop_cmdline_record();
183 unregister_ftrace_graph();
186 static int max_bytes_for_cpu;
188 static enum print_line_t
189 print_graph_cpu(struct trace_seq *s, int cpu)
194 * Start with a space character - to make it stand out
195 * to the right a bit when trace output is pasted into
198 ret = trace_seq_printf(s, " %*d) ", max_bytes_for_cpu, cpu);
200 return TRACE_TYPE_PARTIAL_LINE;
202 return TRACE_TYPE_HANDLED;
205 #define TRACE_GRAPH_PROCINFO_LENGTH 14
207 static enum print_line_t
208 print_graph_proc(struct trace_seq *s, pid_t pid)
210 char comm[TASK_COMM_LEN];
211 /* sign + log10(MAX_INT) + '\0' */
218 trace_find_cmdline(pid, comm);
220 sprintf(pid_str, "%d", pid);
222 /* 1 stands for the "-" character */
223 len = strlen(comm) + strlen(pid_str) + 1;
225 if (len < TRACE_GRAPH_PROCINFO_LENGTH)
226 spaces = TRACE_GRAPH_PROCINFO_LENGTH - len;
228 /* First spaces to align center */
229 for (i = 0; i < spaces / 2; i++) {
230 ret = trace_seq_printf(s, " ");
232 return TRACE_TYPE_PARTIAL_LINE;
235 ret = trace_seq_printf(s, "%s-%s", comm, pid_str);
237 return TRACE_TYPE_PARTIAL_LINE;
239 /* Last spaces to align center */
240 for (i = 0; i < spaces - (spaces / 2); i++) {
241 ret = trace_seq_printf(s, " ");
243 return TRACE_TYPE_PARTIAL_LINE;
245 return TRACE_TYPE_HANDLED;
249 /* If the pid changed since the last trace, output this event */
250 static enum print_line_t
251 verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
258 return TRACE_TYPE_HANDLED;
260 last_pid = &(per_cpu_ptr(data, cpu)->last_pid);
262 if (*last_pid == pid)
263 return TRACE_TYPE_HANDLED;
265 prev_pid = *last_pid;
269 return TRACE_TYPE_HANDLED;
271 * Context-switch trace line:
273 ------------------------------------------
274 | 1) migration/0--1 => sshd-1755
275 ------------------------------------------
278 ret = trace_seq_printf(s,
279 " ------------------------------------------\n");
281 return TRACE_TYPE_PARTIAL_LINE;
283 ret = print_graph_cpu(s, cpu);
284 if (ret == TRACE_TYPE_PARTIAL_LINE)
285 return TRACE_TYPE_PARTIAL_LINE;
287 ret = print_graph_proc(s, prev_pid);
288 if (ret == TRACE_TYPE_PARTIAL_LINE)
289 return TRACE_TYPE_PARTIAL_LINE;
291 ret = trace_seq_printf(s, " => ");
293 return TRACE_TYPE_PARTIAL_LINE;
295 ret = print_graph_proc(s, pid);
296 if (ret == TRACE_TYPE_PARTIAL_LINE)
297 return TRACE_TYPE_PARTIAL_LINE;
299 ret = trace_seq_printf(s,
300 "\n ------------------------------------------\n\n");
302 return TRACE_TYPE_PARTIAL_LINE;
304 return TRACE_TYPE_HANDLED;
307 static struct ftrace_graph_ret_entry *
308 get_return_for_leaf(struct trace_iterator *iter,
309 struct ftrace_graph_ent_entry *curr)
311 struct ring_buffer_iter *ring_iter;
312 struct ring_buffer_event *event;
313 struct ftrace_graph_ret_entry *next;
315 ring_iter = iter->buffer_iter[iter->cpu];
317 /* First peek to compare current entry and the next one */
319 event = ring_buffer_iter_peek(ring_iter, NULL);
321 /* We need to consume the current entry to see the next one */
322 ring_buffer_consume(iter->tr->buffer, iter->cpu, NULL);
323 event = ring_buffer_peek(iter->tr->buffer, iter->cpu,
330 next = ring_buffer_event_data(event);
332 if (next->ent.type != TRACE_GRAPH_RET)
335 if (curr->ent.pid != next->ent.pid ||
336 curr->graph_ent.func != next->ret.func)
339 /* this is a leaf, now advance the iterator */
341 ring_buffer_read(ring_iter, NULL);
346 /* Signal a overhead of time execution to the output */
348 print_graph_overhead(unsigned long long duration, struct trace_seq *s)
350 /* If duration disappear, we don't need anything */
351 if (!(tracer_flags.val & TRACE_GRAPH_PRINT_DURATION))
354 /* Non nested entry or return */
356 return trace_seq_printf(s, " ");
358 if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) {
359 /* Duration exceeded 100 msecs */
360 if (duration > 100000ULL)
361 return trace_seq_printf(s, "! ");
363 /* Duration exceeded 10 msecs */
364 if (duration > 10000ULL)
365 return trace_seq_printf(s, "+ ");
368 return trace_seq_printf(s, " ");
371 static int print_graph_abs_time(u64 t, struct trace_seq *s)
373 unsigned long usecs_rem;
375 usecs_rem = do_div(t, NSEC_PER_SEC);
378 return trace_seq_printf(s, "%5lu.%06lu | ",
379 (unsigned long)t, usecs_rem);
382 static enum print_line_t
383 print_graph_irq(struct trace_iterator *iter, unsigned long addr,
384 enum trace_type type, int cpu, pid_t pid)
387 struct trace_seq *s = &iter->seq;
389 if (addr < (unsigned long)__irqentry_text_start ||
390 addr >= (unsigned long)__irqentry_text_end)
391 return TRACE_TYPE_UNHANDLED;
394 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) {
395 ret = print_graph_abs_time(iter->ts, s);
397 return TRACE_TYPE_PARTIAL_LINE;
401 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
402 ret = print_graph_cpu(s, cpu);
403 if (ret == TRACE_TYPE_PARTIAL_LINE)
404 return TRACE_TYPE_PARTIAL_LINE;
407 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
408 ret = print_graph_proc(s, pid);
409 if (ret == TRACE_TYPE_PARTIAL_LINE)
410 return TRACE_TYPE_PARTIAL_LINE;
411 ret = trace_seq_printf(s, " | ");
413 return TRACE_TYPE_PARTIAL_LINE;
417 ret = print_graph_overhead(-1, s);
419 return TRACE_TYPE_PARTIAL_LINE;
421 if (type == TRACE_GRAPH_ENT)
422 ret = trace_seq_printf(s, "==========>");
424 ret = trace_seq_printf(s, "<==========");
427 return TRACE_TYPE_PARTIAL_LINE;
429 /* Don't close the duration column if haven't one */
430 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
431 trace_seq_printf(s, " |");
432 ret = trace_seq_printf(s, "\n");
435 return TRACE_TYPE_PARTIAL_LINE;
436 return TRACE_TYPE_HANDLED;
440 trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
442 unsigned long nsecs_rem = do_div(duration, 1000);
443 /* log10(ULONG_MAX) + '\0' */
449 sprintf(msecs_str, "%lu", (unsigned long) duration);
452 ret = trace_seq_printf(s, "%s", msecs_str);
454 return TRACE_TYPE_PARTIAL_LINE;
456 len = strlen(msecs_str);
458 /* Print nsecs (we don't want to exceed 7 numbers) */
460 snprintf(nsecs_str, 8 - len, "%03lu", nsecs_rem);
461 ret = trace_seq_printf(s, ".%s", nsecs_str);
463 return TRACE_TYPE_PARTIAL_LINE;
464 len += strlen(nsecs_str);
467 ret = trace_seq_printf(s, " us ");
469 return TRACE_TYPE_PARTIAL_LINE;
471 /* Print remaining spaces to fit the row's width */
472 for (i = len; i < 7; i++) {
473 ret = trace_seq_printf(s, " ");
475 return TRACE_TYPE_PARTIAL_LINE;
477 return TRACE_TYPE_HANDLED;
480 static enum print_line_t
481 print_graph_duration(unsigned long long duration, struct trace_seq *s)
485 ret = trace_print_graph_duration(duration, s);
486 if (ret != TRACE_TYPE_HANDLED)
489 ret = trace_seq_printf(s, "| ");
491 return TRACE_TYPE_PARTIAL_LINE;
493 return TRACE_TYPE_HANDLED;
496 /* Case of a leaf function on its call entry */
497 static enum print_line_t
498 print_graph_entry_leaf(struct trace_iterator *iter,
499 struct ftrace_graph_ent_entry *entry,
500 struct ftrace_graph_ret_entry *ret_entry, struct trace_seq *s)
502 struct fgraph_data *data = iter->private;
503 struct ftrace_graph_ret *graph_ret;
504 struct ftrace_graph_ent *call;
505 unsigned long long duration;
509 graph_ret = &ret_entry->ret;
510 call = &entry->graph_ent;
511 duration = graph_ret->rettime - graph_ret->calltime;
515 int *depth = &(per_cpu_ptr(data, cpu)->depth);
518 * Comments display at + 1 to depth. Since
519 * this is a leaf function, keep the comments
520 * equal to this depth.
522 *depth = call->depth - 1;
526 ret = print_graph_overhead(duration, s);
528 return TRACE_TYPE_PARTIAL_LINE;
531 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
532 ret = print_graph_duration(duration, s);
533 if (ret == TRACE_TYPE_PARTIAL_LINE)
534 return TRACE_TYPE_PARTIAL_LINE;
538 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
539 ret = trace_seq_printf(s, " ");
541 return TRACE_TYPE_PARTIAL_LINE;
544 ret = trace_seq_printf(s, "%pf();\n", (void *)call->func);
546 return TRACE_TYPE_PARTIAL_LINE;
548 return TRACE_TYPE_HANDLED;
551 static enum print_line_t
552 print_graph_entry_nested(struct trace_iterator *iter,
553 struct ftrace_graph_ent_entry *entry,
554 struct trace_seq *s, int cpu)
556 struct ftrace_graph_ent *call = &entry->graph_ent;
557 struct fgraph_data *data = iter->private;
563 int *depth = &(per_cpu_ptr(data, cpu)->depth);
565 *depth = call->depth;
569 ret = print_graph_overhead(-1, s);
571 return TRACE_TYPE_PARTIAL_LINE;
574 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
575 ret = trace_seq_printf(s, " | ");
577 return TRACE_TYPE_PARTIAL_LINE;
581 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
582 ret = trace_seq_printf(s, " ");
584 return TRACE_TYPE_PARTIAL_LINE;
587 ret = trace_seq_printf(s, "%pf() {\n", (void *)call->func);
589 return TRACE_TYPE_PARTIAL_LINE;
592 * we already consumed the current entry to check the next one
593 * and see if this is a leaf.
595 return TRACE_TYPE_NO_CONSUME;
598 static enum print_line_t
599 print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
600 int type, unsigned long addr)
602 struct fgraph_data *data = iter->private;
603 struct trace_entry *ent = iter->ent;
608 if (verif_pid(s, ent->pid, cpu, data) == TRACE_TYPE_PARTIAL_LINE)
609 return TRACE_TYPE_PARTIAL_LINE;
613 ret = print_graph_irq(iter, addr, type, cpu, ent->pid);
614 if (ret == TRACE_TYPE_PARTIAL_LINE)
615 return TRACE_TYPE_PARTIAL_LINE;
619 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) {
620 ret = print_graph_abs_time(iter->ts, s);
622 return TRACE_TYPE_PARTIAL_LINE;
626 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
627 ret = print_graph_cpu(s, cpu);
628 if (ret == TRACE_TYPE_PARTIAL_LINE)
629 return TRACE_TYPE_PARTIAL_LINE;
633 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
634 ret = print_graph_proc(s, ent->pid);
635 if (ret == TRACE_TYPE_PARTIAL_LINE)
636 return TRACE_TYPE_PARTIAL_LINE;
638 ret = trace_seq_printf(s, " | ");
640 return TRACE_TYPE_PARTIAL_LINE;
646 static enum print_line_t
647 print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
648 struct trace_iterator *iter)
651 struct ftrace_graph_ent *call = &field->graph_ent;
652 struct ftrace_graph_ret_entry *leaf_ret;
654 if (print_graph_prologue(iter, s, TRACE_GRAPH_ENT, call->func))
655 return TRACE_TYPE_PARTIAL_LINE;
657 leaf_ret = get_return_for_leaf(iter, field);
659 return print_graph_entry_leaf(iter, field, leaf_ret, s);
661 return print_graph_entry_nested(iter, field, s, cpu);
665 static enum print_line_t
666 print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
667 struct trace_entry *ent, struct trace_iterator *iter)
669 unsigned long long duration = trace->rettime - trace->calltime;
670 struct fgraph_data *data = iter->private;
671 pid_t pid = ent->pid;
678 int *depth = &(per_cpu_ptr(data, cpu)->depth);
681 * Comments display at + 1 to depth. This is the
682 * return from a function, we now want the comments
683 * to display at the same level of the bracket.
685 *depth = trace->depth - 1;
688 if (print_graph_prologue(iter, s, 0, 0))
689 return TRACE_TYPE_PARTIAL_LINE;
692 ret = print_graph_overhead(duration, s);
694 return TRACE_TYPE_PARTIAL_LINE;
697 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
698 ret = print_graph_duration(duration, s);
699 if (ret == TRACE_TYPE_PARTIAL_LINE)
700 return TRACE_TYPE_PARTIAL_LINE;
704 for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) {
705 ret = trace_seq_printf(s, " ");
707 return TRACE_TYPE_PARTIAL_LINE;
710 ret = trace_seq_printf(s, "}\n");
712 return TRACE_TYPE_PARTIAL_LINE;
715 if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERRUN) {
716 ret = trace_seq_printf(s, " (Overruns: %lu)\n",
719 return TRACE_TYPE_PARTIAL_LINE;
722 ret = print_graph_irq(iter, trace->func, TRACE_GRAPH_RET, cpu, pid);
723 if (ret == TRACE_TYPE_PARTIAL_LINE)
724 return TRACE_TYPE_PARTIAL_LINE;
726 return TRACE_TYPE_HANDLED;
729 static enum print_line_t
730 print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
731 struct trace_iterator *iter)
733 unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK);
734 struct fgraph_data *data = iter->private;
735 struct trace_event *event;
741 depth = per_cpu_ptr(data, iter->cpu)->depth;
743 if (print_graph_prologue(iter, s, 0, 0))
744 return TRACE_TYPE_PARTIAL_LINE;
747 ret = print_graph_overhead(-1, s);
749 return TRACE_TYPE_PARTIAL_LINE;
752 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION) {
753 ret = trace_seq_printf(s, " | ");
755 return TRACE_TYPE_PARTIAL_LINE;
760 for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) {
761 ret = trace_seq_printf(s, " ");
763 return TRACE_TYPE_PARTIAL_LINE;
767 ret = trace_seq_printf(s, "/* ");
769 return TRACE_TYPE_PARTIAL_LINE;
771 switch (iter->ent->type) {
773 ret = trace_print_bprintk_msg_only(iter);
774 if (ret != TRACE_TYPE_HANDLED)
778 ret = trace_print_printk_msg_only(iter);
779 if (ret != TRACE_TYPE_HANDLED)
783 event = ftrace_find_event(ent->type);
785 return TRACE_TYPE_UNHANDLED;
787 ret = event->trace(iter, sym_flags);
788 if (ret != TRACE_TYPE_HANDLED)
792 /* Strip ending newline */
793 if (s->buffer[s->len - 1] == '\n') {
794 s->buffer[s->len - 1] = '\0';
798 ret = trace_seq_printf(s, " */\n");
800 return TRACE_TYPE_PARTIAL_LINE;
802 return TRACE_TYPE_HANDLED;
807 print_graph_function(struct trace_iterator *iter)
809 struct trace_entry *entry = iter->ent;
810 struct trace_seq *s = &iter->seq;
812 switch (entry->type) {
813 case TRACE_GRAPH_ENT: {
814 struct ftrace_graph_ent_entry *field;
815 trace_assign_type(field, entry);
816 return print_graph_entry(field, s, iter);
818 case TRACE_GRAPH_RET: {
819 struct ftrace_graph_ret_entry *field;
820 trace_assign_type(field, entry);
821 return print_graph_return(&field->ret, s, entry, iter);
824 return print_graph_comment(s, entry, iter);
827 return TRACE_TYPE_HANDLED;
830 static void print_graph_headers(struct seq_file *s)
834 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME)
835 seq_printf(s, " TIME ");
836 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU)
837 seq_printf(s, "CPU");
838 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC)
839 seq_printf(s, " TASK/PID ");
840 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
841 seq_printf(s, " DURATION ");
842 seq_printf(s, " FUNCTION CALLS\n");
846 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME)
847 seq_printf(s, " | ");
848 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU)
850 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC)
851 seq_printf(s, " | | ");
852 if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
853 seq_printf(s, " | | ");
854 seq_printf(s, " | | | |\n");
857 static void graph_trace_open(struct trace_iterator *iter)
859 /* pid and depth on the last trace processed */
860 struct fgraph_data *data = alloc_percpu(struct fgraph_data);
864 pr_warning("function graph tracer: not enough memory\n");
866 for_each_possible_cpu(cpu) {
867 pid_t *pid = &(per_cpu_ptr(data, cpu)->last_pid);
868 int *depth = &(per_cpu_ptr(data, cpu)->depth);
873 iter->private = data;
876 static void graph_trace_close(struct trace_iterator *iter)
878 free_percpu(iter->private);
881 static struct tracer graph_trace __read_mostly = {
882 .name = "function_graph",
883 .open = graph_trace_open,
884 .close = graph_trace_close,
885 .wait_pipe = poll_wait_pipe,
886 .init = graph_trace_init,
887 .reset = graph_trace_reset,
888 .print_line = print_graph_function,
889 .print_header = print_graph_headers,
890 .flags = &tracer_flags,
891 #ifdef CONFIG_FTRACE_SELFTEST
892 .selftest = trace_selftest_startup_function_graph,
896 static __init int init_graph_trace(void)
898 max_bytes_for_cpu = snprintf(NULL, 0, "%d", nr_cpu_ids - 1);
900 return register_tracer(&graph_trace);
903 device_initcall(init_graph_trace);