Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH v2 3/3] trace-cmd: setting plugin to 'nop' clears data before it's recorded

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


mark.asselstine at windriver

Apr 8, 2012, 8:38 AM

Post #1 of 3 (52 views)
Permalink
[PATCH v2 3/3] trace-cmd: setting plugin to 'nop' clears data before it's recorded

commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
[trace-cmd: Add trace-cmd record --date option]

moved the call to disable_all() in trace_record() from after record_data()
to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
which has the side affect of clearing 'trace', thus all the latency tracer
reports are empty/useless. Here we make disable_all() optionally call
set_plugin() thus, where we need to, we can delay the disabling of the tracer
until we have had a chance to capture 'trace'. We have added this delayed
behavior to trace_record() to fix the latency reports, for all other calls to
disable_all() we continue to have set_plugin() called.

Signed-off-by: Mark Asselstine <mark.asselstine [at] windriver>
---
[v2] * remove redundant conditional usage
* add conditional param for disable_all() instead of adding new func
* used int and not gboolean to avoid gtk includes where not needed

trace-record.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/trace-record.c b/trace-record.c
index 1c56fa9..95d4a2a 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -897,11 +897,13 @@ static void disable_tracing(void)
write_tracing_on(0);
}

-static void disable_all(void)
+static void disable_all(int disable_tracer)
{
disable_tracing();

- set_plugin("nop");
+ if (disable_tracer)
+ set_plugin("nop");
+
reset_events();

/* Force close and reset of ftrace pid file */
@@ -1573,7 +1575,7 @@ static void set_funcs(void)
/* make sure we are filtering functions */
if (func_stack) {
if (!functions_filtered()) {
- disable_all();
+ disable_all(1);
die("Function stack trace set, but functions not filtered");
}
save_option(FUNC_STACK_TRACE);
@@ -1938,7 +1940,7 @@ void trace_record (int argc, char **argv)
break;
}
}
- disable_all();
+ disable_all(1);
set_buffer_size();
exit(0);
} else
@@ -2147,7 +2149,7 @@ void trace_record (int argc, char **argv)

if (!extract) {
fset = set_ftrace(!disable);
- disable_all();
+ disable_all(1);

/* Record records the date first */
if (record && date)
@@ -2227,7 +2229,7 @@ void trace_record (int argc, char **argv)
}

if (!keep)
- disable_all();
+ disable_all(0);

printf("Kernel buffer statistics:\n"
" Note: \"entries\" are the entries left in the kernel ring buffer and are not\n"
@@ -2249,6 +2251,8 @@ void trace_record (int argc, char **argv)
if (keep)
exit(0);

+ set_plugin("nop");
+
/* If tracing_on was enabled before we started, set it on now */
if (tracing_on_init_val)
write_tracing_on(tracing_on_init_val);
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


rostedt at goodmis

May 23, 2012, 2:33 AM

Post #2 of 3 (35 views)
Permalink
Re: [PATCH v2 3/3] trace-cmd: setting plugin to 'nop' clears data before it's recorded [In reply to]

On Sun, 2012-04-08 at 11:38 -0400, Mark Asselstine wrote:
> commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
> [trace-cmd: Add trace-cmd record --date option]
>
> moved the call to disable_all() in trace_record() from after record_data()
> to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
> which has the side affect of clearing 'trace', thus all the latency tracer
> reports are empty/useless. Here we make disable_all() optionally call
> set_plugin() thus, where we need to, we can delay the disabling of the tracer
> until we have had a chance to capture 'trace'. We have added this delayed
> behavior to trace_record() to fix the latency reports, for all other calls to
> disable_all() we continue to have set_plugin() called.
>

Just letting you know that I just pushed your changes to my repo. Sorry
for being late, I got side-tracked, and forgot about your changes.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


mark.asselstine at windriver

May 23, 2012, 6:26 AM

Post #3 of 3 (37 views)
Permalink
Re: [PATCH v2 3/3] trace-cmd: setting plugin to 'nop' clears data before it's recorded [In reply to]

On May 23, 2012 05:33:12 Steven Rostedt wrote:
> On Sun, 2012-04-08 at 11:38 -0400, Mark Asselstine wrote:
> > commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
> > [trace-cmd: Add trace-cmd record --date option]
> >
> > moved the call to disable_all() in trace_record() from after record_data()
> > to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
> > which has the side affect of clearing 'trace', thus all the latency tracer
> > reports are empty/useless. Here we make disable_all() optionally call
> > set_plugin() thus, where we need to, we can delay the disabling of the
> > tracer until we have had a chance to capture 'trace'. We have added this
> > delayed behavior to trace_record() to fix the latency reports, for all
> > other calls to disable_all() we continue to have set_plugin() called.
>
> Just letting you know that I just pushed your changes to my repo. Sorry
> for being late, I got side-tracked, and forgot about your changes.
>
> -- Steve

No problem, happy to help.

Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.