diff options
author | Clark Williams <williams@redhat.com> | 2011-09-07 16:23:31 -0500 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2011-09-07 16:23:31 -0500 |
commit | aca74c66e53b884ecd9638a2be286794e0d43c40 (patch) | |
tree | fdfbae78054a0d8d9989a8cad80d8445c6fd237e | |
parent | ff044e71420ccaf066adc02d27df53edffc76b5b (diff) | |
download | rt-tests-aca74c66e53b884ecd9638a2be286794e0d43c40.tar.gz |
modify /proc/sys/kernel/ftrace_enabled handling
Only turn on ftrace_enabled if we're doing tracing that requires
the function tracer. Don't turn it on for event-based tracing. Also,
turn it off a the end of a run.
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | src/cyclictest/cyclictest.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index c5cc807..b222cb7 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -117,6 +117,7 @@ enum { WAKEUP, WAKEUPRT, LATENCY, + FUNCTION, CUSTOM, }; @@ -411,7 +412,6 @@ static void setup_tracer(void) fileprefix = procfileprefix; if (kernelversion >= KV_26_33) { - char buffer[32]; int ret; if (trace_file_exists("tracing_enabled") && @@ -419,8 +419,10 @@ static void setup_tracer(void) setkernvar("tracing_enabled", "1"); /* ftrace_enabled is a sysctl variable */ + /* turn it on if you're doing anything but nop or event tracing */ + fileprefix = procfileprefix; - if (ftrace) + if (tracetype) setkernvar("ftrace_enabled", "1"); else setkernvar("ftrace_enabled", "0"); @@ -435,6 +437,11 @@ static void setup_tracer(void) switch (tracetype) { case NOTRACE: + /* no tracer specified, use events */ + enable_events = 1; + break; + case FUNCTION: + ret = settracer("function"); break; case IRQSOFF: ret = settracer("irqsoff"); @@ -1004,7 +1011,7 @@ static void process_options (int argc, char *argv[]) case 'C': tracetype = CTXTSWITCH; break; case 'd': distance = atoi(optarg); break; case 'E': enable_events = 1; break; - case 'f': ftrace = 1; break; + case 'f': tracetype = FUNCTION; ftrace = 1; break; case 'H': histofall = 1; /* fall through */ case 'h': histogram = atoi(optarg); break; case 'i': interval = atoi(optarg); break; @@ -1575,6 +1582,12 @@ int main(int argc, char **argv) /* turn off all events */ event_disable_all(); + /* turn off the function tracer */ + fileprefix = procfileprefix; + if (tracetype) + setkernvar("ftrace_enabled", "0"); + fileprefix = get_debugfileprefix(); + /* unlock everything */ if (lockall) munlockall(); |