• Home
  • Raw
  • Download

Lines Matching refs:ftrace

245 static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused)  in reset_tracing_options()
257 static int reset_tracing_files(struct perf_ftrace *ftrace __maybe_unused) in reset_tracing_files()
278 reset_tracing_options(ftrace); in reset_tracing_files()
282 static int set_tracing_pid(struct perf_ftrace *ftrace) in set_tracing_pid() argument
287 if (target__has_cpu(&ftrace->target)) in set_tracing_pid()
290 for (i = 0; i < perf_thread_map__nr(ftrace->evlist->core.threads); i++) { in set_tracing_pid()
292 perf_thread_map__pid(ftrace->evlist->core.threads, i)); in set_tracing_pid()
324 static int set_tracing_cpu(struct perf_ftrace *ftrace) in set_tracing_cpu() argument
326 struct perf_cpu_map *cpumap = ftrace->evlist->core.cpus; in set_tracing_cpu()
328 if (!target__has_cpu(&ftrace->target)) in set_tracing_cpu()
334 static int set_tracing_func_stack_trace(struct perf_ftrace *ftrace) in set_tracing_func_stack_trace() argument
336 if (!ftrace->func_stack_trace) in set_tracing_func_stack_trace()
345 static int set_tracing_func_irqinfo(struct perf_ftrace *ftrace) in set_tracing_func_irqinfo() argument
347 if (!ftrace->func_irq_info) in set_tracing_func_irqinfo()
378 static int set_tracing_filters(struct perf_ftrace *ftrace) in set_tracing_filters() argument
382 ret = __set_tracing_filter("set_ftrace_filter", &ftrace->filters); in set_tracing_filters()
386 ret = __set_tracing_filter("set_ftrace_notrace", &ftrace->notrace); in set_tracing_filters()
390 ret = __set_tracing_filter("set_graph_function", &ftrace->graph_funcs); in set_tracing_filters()
395 __set_tracing_filter("set_graph_notrace", &ftrace->nograph_funcs); in set_tracing_filters()
408 static int set_tracing_depth(struct perf_ftrace *ftrace) in set_tracing_depth() argument
410 if (ftrace->graph_depth == 0) in set_tracing_depth()
413 if (ftrace->graph_depth < 0) { in set_tracing_depth()
414 pr_err("invalid graph depth: %d\n", ftrace->graph_depth); in set_tracing_depth()
418 if (write_tracing_file_int("max_graph_depth", ftrace->graph_depth) < 0) in set_tracing_depth()
424 static int set_tracing_percpu_buffer_size(struct perf_ftrace *ftrace) in set_tracing_percpu_buffer_size() argument
428 if (ftrace->percpu_buffer_size == 0) in set_tracing_percpu_buffer_size()
432 ftrace->percpu_buffer_size / 1024); in set_tracing_percpu_buffer_size()
439 static int set_tracing_trace_inherit(struct perf_ftrace *ftrace) in set_tracing_trace_inherit() argument
441 if (!ftrace->inherit) in set_tracing_trace_inherit()
450 static int set_tracing_sleep_time(struct perf_ftrace *ftrace) in set_tracing_sleep_time() argument
452 if (!ftrace->graph_nosleep_time) in set_tracing_sleep_time()
461 static int set_tracing_funcgraph_irqs(struct perf_ftrace *ftrace) in set_tracing_funcgraph_irqs() argument
463 if (!ftrace->graph_noirqs) in set_tracing_funcgraph_irqs()
472 static int set_tracing_funcgraph_verbose(struct perf_ftrace *ftrace) in set_tracing_funcgraph_verbose() argument
474 if (!ftrace->graph_verbose) in set_tracing_funcgraph_verbose()
489 static int set_tracing_thresh(struct perf_ftrace *ftrace) in set_tracing_thresh() argument
493 if (ftrace->graph_thresh == 0) in set_tracing_thresh()
496 ret = write_tracing_file_int("tracing_thresh", ftrace->graph_thresh); in set_tracing_thresh()
503 static int set_tracing_options(struct perf_ftrace *ftrace) in set_tracing_options() argument
505 if (set_tracing_pid(ftrace) < 0) { in set_tracing_options()
510 if (set_tracing_cpu(ftrace) < 0) { in set_tracing_options()
515 if (set_tracing_func_stack_trace(ftrace) < 0) { in set_tracing_options()
520 if (set_tracing_func_irqinfo(ftrace) < 0) { in set_tracing_options()
525 if (set_tracing_filters(ftrace) < 0) { in set_tracing_options()
530 if (set_tracing_depth(ftrace) < 0) { in set_tracing_options()
535 if (set_tracing_percpu_buffer_size(ftrace) < 0) { in set_tracing_options()
540 if (set_tracing_trace_inherit(ftrace) < 0) { in set_tracing_options()
545 if (set_tracing_sleep_time(ftrace) < 0) { in set_tracing_options()
550 if (set_tracing_funcgraph_irqs(ftrace) < 0) { in set_tracing_options()
555 if (set_tracing_funcgraph_verbose(ftrace) < 0) { in set_tracing_options()
560 if (set_tracing_thresh(ftrace) < 0) { in set_tracing_options()
568 static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv) in __cmd_ftrace() argument
594 if (reset_tracing_files(ftrace) < 0) { in __cmd_ftrace()
603 if (argc && perf_evlist__prepare_workload(ftrace->evlist, in __cmd_ftrace()
604 &ftrace->target, argv, false, in __cmd_ftrace()
609 if (set_tracing_options(ftrace) < 0) in __cmd_ftrace()
612 if (write_tracing_file("current_tracer", ftrace->tracer) < 0) { in __cmd_ftrace()
613 pr_err("failed to set current_tracer to %s\n", ftrace->tracer); in __cmd_ftrace()
640 if (!ftrace->initial_delay) { in __cmd_ftrace()
647 perf_evlist__start_workload(ftrace->evlist); in __cmd_ftrace()
649 if (ftrace->initial_delay) { in __cmd_ftrace()
650 usleep(ftrace->initial_delay * 1000); in __cmd_ftrace()
692 reset_tracing_files(ftrace); in __cmd_ftrace()
699 struct perf_ftrace *ftrace = cb; in perf_ftrace_config() local
709 ftrace->tracer = value; in perf_ftrace_config()
818 struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value; in parse_func_tracer_opts() local
820 { .name = "call-graph", .value_ptr = &ftrace->func_stack_trace }, in parse_func_tracer_opts()
821 { .name = "irq-info", .value_ptr = &ftrace->func_irq_info }, in parse_func_tracer_opts()
839 struct perf_ftrace *ftrace = (struct perf_ftrace *) opt->value; in parse_graph_tracer_opts() local
841 { .name = "nosleep-time", .value_ptr = &ftrace->graph_nosleep_time }, in parse_graph_tracer_opts()
842 { .name = "noirqs", .value_ptr = &ftrace->graph_noirqs }, in parse_graph_tracer_opts()
843 { .name = "verbose", .value_ptr = &ftrace->graph_verbose }, in parse_graph_tracer_opts()
844 { .name = "thresh", .value_ptr = &ftrace->graph_thresh }, in parse_graph_tracer_opts()
845 { .name = "depth", .value_ptr = &ftrace->graph_depth }, in parse_graph_tracer_opts()
859 static void select_tracer(struct perf_ftrace *ftrace) in select_tracer() argument
861 bool graph = !list_empty(&ftrace->graph_funcs) || in select_tracer()
862 !list_empty(&ftrace->nograph_funcs); in select_tracer()
863 bool func = !list_empty(&ftrace->filters) || in select_tracer()
864 !list_empty(&ftrace->notrace); in select_tracer()
868 ftrace->tracer = "function_graph"; in select_tracer()
870 ftrace->tracer = "function"; in select_tracer()
873 pr_debug("%s tracer is used\n", ftrace->tracer); in select_tracer()
879 struct perf_ftrace ftrace = { in cmd_ftrace() local
889 OPT_STRING('t', "tracer", &ftrace.tracer, "tracer", in cmd_ftrace()
894 OPT_STRING('p', "pid", &ftrace.target.pid, "pid", in cmd_ftrace()
897 OPT_STRING(0, "tid", &ftrace.target.tid, "tid", in cmd_ftrace()
901 OPT_BOOLEAN('a', "all-cpus", &ftrace.target.system_wide, in cmd_ftrace()
903 OPT_STRING('C', "cpu", &ftrace.target.cpu_list, "cpu", in cmd_ftrace()
905 OPT_CALLBACK('T', "trace-funcs", &ftrace.filters, "func", in cmd_ftrace()
908 OPT_CALLBACK('N', "notrace-funcs", &ftrace.notrace, "func", in cmd_ftrace()
910 OPT_CALLBACK(0, "func-opts", &ftrace, "options", in cmd_ftrace()
913 OPT_CALLBACK('G', "graph-funcs", &ftrace.graph_funcs, "func", in cmd_ftrace()
916 OPT_CALLBACK('g', "nograph-funcs", &ftrace.nograph_funcs, "func", in cmd_ftrace()
918 OPT_CALLBACK(0, "graph-opts", &ftrace, "options", in cmd_ftrace()
921 OPT_CALLBACK('m', "buffer-size", &ftrace.percpu_buffer_size, "size", in cmd_ftrace()
923 OPT_BOOLEAN(0, "inherit", &ftrace.inherit, in cmd_ftrace()
925 OPT_UINTEGER('D', "delay", &ftrace.initial_delay, in cmd_ftrace()
930 INIT_LIST_HEAD(&ftrace.filters); in cmd_ftrace()
931 INIT_LIST_HEAD(&ftrace.notrace); in cmd_ftrace()
932 INIT_LIST_HEAD(&ftrace.graph_funcs); in cmd_ftrace()
933 INIT_LIST_HEAD(&ftrace.nograph_funcs); in cmd_ftrace()
935 ret = perf_config(perf_ftrace_config, &ftrace); in cmd_ftrace()
941 if (!argc && target__none(&ftrace.target)) in cmd_ftrace()
942 ftrace.target.system_wide = true; in cmd_ftrace()
944 select_tracer(&ftrace); in cmd_ftrace()
946 ret = target__validate(&ftrace.target); in cmd_ftrace()
950 target__strerror(&ftrace.target, ret, errbuf, 512); in cmd_ftrace()
955 ftrace.evlist = evlist__new(); in cmd_ftrace()
956 if (ftrace.evlist == NULL) { in cmd_ftrace()
961 ret = perf_evlist__create_maps(ftrace.evlist, &ftrace.target); in cmd_ftrace()
965 ret = __cmd_ftrace(&ftrace, argc, argv); in cmd_ftrace()
968 evlist__delete(ftrace.evlist); in cmd_ftrace()
971 delete_filter_func(&ftrace.filters); in cmd_ftrace()
972 delete_filter_func(&ftrace.notrace); in cmd_ftrace()
973 delete_filter_func(&ftrace.graph_funcs); in cmd_ftrace()
974 delete_filter_func(&ftrace.nograph_funcs); in cmd_ftrace()