@@ -44,6 +44,7 @@ struct perf_ftrace {
44
44
unsigned long percpu_buffer_size ;
45
45
bool inherit ;
46
46
int func_stack_trace ;
47
+ int graph_nosleep_time ;
47
48
};
48
49
49
50
struct filter_entry {
@@ -205,6 +206,7 @@ static void reset_tracing_options(struct perf_ftrace *ftrace __maybe_unused)
205
206
{
206
207
write_tracing_option_file ("function-fork" , "0" );
207
208
write_tracing_option_file ("func_stack_trace" , "0" );
209
+ write_tracing_option_file ("sleep-time" , "1" );
208
210
}
209
211
210
212
static int reset_tracing_files (struct perf_ftrace * ftrace __maybe_unused )
@@ -386,6 +388,17 @@ static int set_tracing_trace_inherit(struct perf_ftrace *ftrace)
386
388
return 0 ;
387
389
}
388
390
391
+ static int set_tracing_sleep_time (struct perf_ftrace * ftrace )
392
+ {
393
+ if (!ftrace -> graph_nosleep_time )
394
+ return 0 ;
395
+
396
+ if (write_tracing_option_file ("sleep-time" , "0" ) < 0 )
397
+ return -1 ;
398
+
399
+ return 0 ;
400
+ }
401
+
389
402
static int __cmd_ftrace (struct perf_ftrace * ftrace , int argc , const char * * argv )
390
403
{
391
404
char * trace_file ;
@@ -465,6 +478,11 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
465
478
goto out_reset ;
466
479
}
467
480
481
+ if (set_tracing_sleep_time (ftrace ) < 0 ) {
482
+ pr_err ("failed to set tracing option sleep-time\n" );
483
+ goto out_reset ;
484
+ }
485
+
468
486
if (write_tracing_file ("current_tracer" , ftrace -> tracer ) < 0 ) {
469
487
pr_err ("failed to set current_tracer to %s\n" , ftrace -> tracer );
470
488
goto out_reset ;
@@ -637,6 +655,26 @@ static int parse_func_tracer_opts(const struct option *opt,
637
655
return 0 ;
638
656
}
639
657
658
+ static int parse_graph_tracer_opts (const struct option * opt ,
659
+ const char * str , int unset )
660
+ {
661
+ int ret ;
662
+ struct perf_ftrace * ftrace = (struct perf_ftrace * ) opt -> value ;
663
+ struct sublevel_option graph_tracer_opts [] = {
664
+ { .name = "nosleep-time" , .value_ptr = & ftrace -> graph_nosleep_time },
665
+ { .name = NULL , }
666
+ };
667
+
668
+ if (unset )
669
+ return 0 ;
670
+
671
+ ret = perf_parse_sublevel_options (str , graph_tracer_opts );
672
+ if (ret )
673
+ return ret ;
674
+
675
+ return 0 ;
676
+ }
677
+
640
678
static void select_tracer (struct perf_ftrace * ftrace )
641
679
{
642
680
bool graph = !list_empty (& ftrace -> graph_funcs ) ||
@@ -694,6 +732,9 @@ int cmd_ftrace(int argc, const char **argv)
694
732
"Set nograph filter on given functions" , parse_filter_func ),
695
733
OPT_INTEGER ('D' , "graph-depth" , & ftrace .graph_depth ,
696
734
"Max depth for function graph tracer" ),
735
+ OPT_CALLBACK (0 , "graph-opts" , & ftrace , "options" ,
736
+ "graph tracer options, available options: nosleep-time" ,
737
+ parse_graph_tracer_opts ),
697
738
OPT_CALLBACK ('m' , "buffer-size" , & ftrace .percpu_buffer_size , "size" ,
698
739
"size of per cpu buffer" , parse_buffer_size ),
699
740
OPT_BOOLEAN (0 , "inherit" , & ftrace .inherit ,
0 commit comments