summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch')
-rw-r--r--meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch96
1 files changed, 96 insertions, 0 deletions
diff --git a/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
new file mode 100644
index 0000000000..724e1e80b1
--- /dev/null
+++ b/meta/recipes-kernel/trace-cmd/trace-cmd/trace-cmd-Setting-plugin-to-nop-clears-data-before-i.patch
@@ -0,0 +1,96 @@
1From d65740d61e7a4ea6d8d77237954b33dd18e3276c Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Sun, 8 Apr 2012 11:38:45 -0400
4Subject: [PATCH] trace-cmd: Setting plugin to 'nop' clears data before it's
5 recorded
6
7Upstream-Status: Backport
8
9commit e09a5db1a929ab668c273b87c4f0a32b81e1c21a
10[trace-cmd: Add trace-cmd record --date option]
11
12moved the call to disable_all() in trace_record() from after record_data()
13to before it. Unfortunately disable_all() sets 'nop' in 'current_tracer'
14which has the side affect of clearing 'trace', thus all the latency tracer
15reports are empty/useless. Here we make disable_all() optionally call
16set_plugin() thus, where we need to, we can delay the disabling of the tracer
17until we have had a chance to capture 'trace'. We have added this delayed
18behavior to trace_record() to fix the latency reports, for all other calls to
19disable_all() we continue to have set_plugin() called.
20
21Link: http://lkml.kernel.org/r/1333899525-6436-1-git-send-email-mark.asselstine@windriver.com
22
23Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
24Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
25---
26 trace-record.c | 16 ++++++++++------
27 1 file changed, 10 insertions(+), 6 deletions(-)
28
29diff --git a/trace-record.c b/trace-record.c
30index 1c56fa9..95d4a2a 100644
31--- a/trace-record.c
32+++ b/trace-record.c
33@@ -897,11 +897,13 @@ static void disable_tracing(void)
34 write_tracing_on(0);
35 }
36
37-static void disable_all(void)
38+static void disable_all(int disable_tracer)
39 {
40 disable_tracing();
41
42- set_plugin("nop");
43+ if (disable_tracer)
44+ set_plugin("nop");
45+
46 reset_events();
47
48 /* Force close and reset of ftrace pid file */
49@@ -1573,7 +1575,7 @@ static void set_funcs(void)
50 /* make sure we are filtering functions */
51 if (func_stack) {
52 if (!functions_filtered()) {
53- disable_all();
54+ disable_all(1);
55 die("Function stack trace set, but functions not filtered");
56 }
57 save_option(FUNC_STACK_TRACE);
58@@ -1938,7 +1940,7 @@ void trace_record (int argc, char **argv)
59 break;
60 }
61 }
62- disable_all();
63+ disable_all(1);
64 set_buffer_size();
65 exit(0);
66 } else
67@@ -2147,7 +2149,7 @@ void trace_record (int argc, char **argv)
68
69 if (!extract) {
70 fset = set_ftrace(!disable);
71- disable_all();
72+ disable_all(1);
73
74 /* Record records the date first */
75 if (record && date)
76@@ -2227,7 +2229,7 @@ void trace_record (int argc, char **argv)
77 }
78
79 if (!keep)
80- disable_all();
81+ disable_all(0);
82
83 printf("Kernel buffer statistics:\n"
84 " Note: \"entries\" are the entries left in the kernel ring buffer and are not\n"
85@@ -2249,6 +2251,8 @@ void trace_record (int argc, char **argv)
86 if (keep)
87 exit(0);
88
89+ set_plugin("nop");
90+
91 /* If tracing_on was enabled before we started, set it on now */
92 if (tracing_on_init_val)
93 write_tracing_on(tracing_on_init_val);
94--
951.7.10.4
96