diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-12-03 08:09:26 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-04 13:24:47 -0500 |
commit | e0549f11e8d57c1a606773342b3b71c74f9986eb (patch) | |
tree | ee60690c3acb8eb25325ef23425a217459c3d9c4 /tools/lib/traceevent | |
parent | f772abc63462a48df605259fbe1af3fe9b223926 (diff) |
tools lib traceevent: Add jbd2 plugin
Backporting jbd2 plugin.
Backported from Steven Rostedt's trace-cmd repo (HEAD 0f2c2fb):
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
This plugin adds field resolving functions for following tracepoint
events:
jbd2:jbd2_checkpoint_stats
jbd2:jbd2_run_stats
The diff of 'perf script' output generated by old and new code:
(data was generated by 'perf record -e 'jbd2:jbd2_run_stats,jbd2:jbd2_checkpoint_stats' -a')
--- script.jbd2.old
+++ script.jbd2.new
- jbd2/dm-3-8 576 [000] 2983.748423: jbd2:jbd2_checkpoint_stats: [FAILED TO PARSE] dev=265289731 tid=0x3f2bbb chp_time=0x0 forced_to_close=0 written=0 dropped=2
+ jbd2/dm-3-8 576 [000] 2983.748423: jbd2:jbd2_checkpoint_stats: dev 253,3 tid 4139963 chp_time 0 forced_to_close 0 written 0 dropped 2
- jbd2/dm-3-8 576 [000] 2983.852789: jbd2:jbd2_run_stats: [FAILED TO PARSE] dev=265289731 tid=0x3f2bc0 wait=0x0 request_delay=0x0 running=0x138d locked=0x0 flushing=0x0 logging=0x68 handle_count=2995 blocks=17 blocks_logged=18
+ jbd2/dm-3-8 576 [000] 2983.852789: jbd2:jbd2_run_stats: dev 253,3 tid 4139968 wait 0 request_delay 0 running 5005 locked 0 flushing 0 logging 104 handle_count 2995 blocks 17 blocks_logged 18
This plugin also adds jbd2_dev_to_name function, which was removed from
jdb2 tracepoints recently. Keeping it in for backward compatibility
reasons.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386076182-14484-13-git-send-email-jolsa@redhat.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent')
-rw-r--r-- | tools/lib/traceevent/Makefile | 2 | ||||
-rw-r--r-- | tools/lib/traceevent/plugin_jbd2.c | 66 |
2 files changed, 68 insertions, 0 deletions
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index f9468519d5f7..6c6540075a67 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -212,6 +212,8 @@ PEVENT_LIB_OBJS += parse-filter.o | |||
212 | PEVENT_LIB_OBJS += parse-utils.o | 212 | PEVENT_LIB_OBJS += parse-utils.o |
213 | PEVENT_LIB_OBJS += kbuffer-parse.o | 213 | PEVENT_LIB_OBJS += kbuffer-parse.o |
214 | 214 | ||
215 | PLUGIN_OBJS = plugin_jbd2.o | ||
216 | |||
215 | PLUGINS := $(PLUGIN_OBJS:.o=.so) | 217 | PLUGINS := $(PLUGIN_OBJS:.o=.so) |
216 | 218 | ||
217 | ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS) | 219 | ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS) |
diff --git a/tools/lib/traceevent/plugin_jbd2.c b/tools/lib/traceevent/plugin_jbd2.c new file mode 100644 index 000000000000..5d85de741b52 --- /dev/null +++ b/tools/lib/traceevent/plugin_jbd2.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Red Hat Inc, Steven Rostedt <srostedt@redhat.com> | ||
3 | * | ||
4 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU Lesser General Public | ||
7 | * License as published by the Free Software Foundation; | ||
8 | * version 2.1 of the License (not later!) | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU Lesser General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this program; if not, see <http://www.gnu.org/licenses> | ||
17 | * | ||
18 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
19 | */ | ||
20 | #include <stdio.h> | ||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
23 | |||
24 | #include "event-parse.h" | ||
25 | |||
26 | #define MINORBITS 20 | ||
27 | #define MINORMASK ((1U << MINORBITS) - 1) | ||
28 | |||
29 | #define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) | ||
30 | #define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) | ||
31 | |||
32 | unsigned long long process_jbd2_dev_to_name(struct trace_seq *s, | ||
33 | unsigned long long *args) | ||
34 | { | ||
35 | unsigned int dev = args[0]; | ||
36 | |||
37 | trace_seq_printf(s, "%d:%d", MAJOR(dev), MINOR(dev)); | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | unsigned long long process_jiffies_to_msecs(struct trace_seq *s, | ||
42 | unsigned long long *args) | ||
43 | { | ||
44 | unsigned long long jiffies = args[0]; | ||
45 | |||
46 | trace_seq_printf(s, "%lld", jiffies); | ||
47 | return jiffies; | ||
48 | } | ||
49 | |||
50 | int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | ||
51 | { | ||
52 | pevent_register_print_function(pevent, | ||
53 | process_jbd2_dev_to_name, | ||
54 | PEVENT_FUNC_ARG_STRING, | ||
55 | "jbd2_dev_to_name", | ||
56 | PEVENT_FUNC_ARG_INT, | ||
57 | PEVENT_FUNC_ARG_VOID); | ||
58 | |||
59 | pevent_register_print_function(pevent, | ||
60 | process_jiffies_to_msecs, | ||
61 | PEVENT_FUNC_ARG_LONG, | ||
62 | "jiffies_to_msecs", | ||
63 | PEVENT_FUNC_ARG_LONG, | ||
64 | PEVENT_FUNC_ARG_VOID); | ||
65 | return 0; | ||
66 | } | ||