Author: Lim,GeunSik Date: Fri Apr 24 10:13:55 2009 +0900 [PATCH] cyclictest: Add tracing function about wakeup and wakeup_rt of ftrace. This is patch to support wakeup & wakeup_rt tracing at the argument of cyclictest additionally. Current cyclictest support three tracing like PREEMPTOFF, IRQSOFF, PREEMPTIRQSOFF just. This additional function will help wakeup related tracing about sleep api [ex: nanosleep() , usleep] of cyclictest. Practically speaking, wakeup(+wakeup-rt) tracing by steven rostedt is useful in the linux based embedded product development. After patching, Fedora9#> cat /debug/tracing/available_tracers syscall blk kmemtrace power branch function_graph mmiotrace wakeup_rt wakeup \ preemptirqsoff preemptoff irqsoff function sched_switch initcall nop Fedora9#> cyclictest -t 5 -p 80 -b 1000 -w -D 10 [enter] <--- tracing wakeup Fedora9#> cat /debug/tracing/trace Fedora9#> cyclictest -t 5 -p 80 -b 1000 -W -D 10 [enter] <--- tracing wakeup-rt Fedora9#> cat /debug/tracing/trace Signed-off-by: GeunSik Lim diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 884f2c3..93b895b 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -93,6 +93,8 @@ enum { IRQSOFF, PREEMPTOFF, IRQPREEMPTOFF, + WAKEUP, + WAKEUPRT, }; #define HIST_MAX 1000000 @@ -415,6 +417,13 @@ static void setup_tracer(void) case CTXTSWITCH: ret = settracer("sched_switch"); break; + case WAKEUP: + ret = settracer("wakeup"); + break; + case WAKEUPRT: + ret = settracer("wakeup_rt"); + break; + default: printf("cyclictest: unknown tracer!\n"); ret = 0; @@ -711,6 +720,9 @@ static void display_help(void) " to modify value to minutes, hours or days\n" "-h --histogram=US dump a latency histogram to stdout after the run\n" " US is the max time to be be tracked in microseconds\n" + "-w --wakeup rt task wakeup tracing (used with -b)\n" + "-W --wakeuprt non_rt task wakeup_rt tracing (used with -b)\n" + ); exit(0); } @@ -773,10 +785,12 @@ static void process_options (int argc, char *argv[]) {"threads", optional_argument, NULL, 't'}, {"verbose", no_argument, NULL, 'v'}, {"duration",required_argument, NULL, 'D'}, + {"wakeup", no_argument, NULL, 'w'}, + {"wakeuprt", no_argument, NULL, 'W'}, {"help", no_argument, NULL, '?'}, {NULL, 0, NULL, 0} }; - int c = getopt_long (argc, argv, "a::b:Bc:Cd:Efh:i:Il:nNo:p:Pmqrst::vD:", + int c = getopt_long (argc, argv, "a::b:Bc:Cd:Efh:i:Il:nNo:p:Pmqrst::vD:wW:", long_options, &option_index); if (c == -1) break; @@ -821,8 +835,9 @@ static void process_options (int argc, char *argv[]) break; case 'v': verbose = 1; break; case 'm': lockall = 1; break; - case 'D': duration = parse_time_string(optarg); - break; + case 'D': duration = parse_time_string(optarg); break; + case 'w': tracetype = WAKEUP; break; + case 'W': tracetype = WAKEUPRT; break; case '?': error = 1; break; } }