aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-03-23 10:31:16 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-03-23 11:24:09 -0400
commit3ab31ea9a15fb0b8195a3d3af599d7d0bb4f073e (patch)
tree01d8923a69c4d489bcefd62d940d9166825d6c70
parent7734efa436eb2a5fa86f079b9d8fa973b977e0dc (diff)
trace-cmd: Added jbd2 plugin
Added the jbd2 plugin that adds the helper functions to handle jbd2_dev_to_name() and jiffies_to_msecs(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--Makefile2
-rw-r--r--plugin_jbd2.c69
2 files changed, 70 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 4f35ca0..b094abe 100644
--- a/Makefile
+++ b/Makefile
@@ -210,7 +210,7 @@ TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \
210 trace-output.o trace-record.o 210 trace-output.o trace-record.o
211 211
212PLUGIN_OBJS = plugin_hrtimer.o plugin_kmem.o plugin_sched_switch.o \ 212PLUGIN_OBJS = plugin_hrtimer.o plugin_kmem.o plugin_sched_switch.o \
213 plugin_mac80211.o 213 plugin_mac80211.o plugin_jbd2.o
214 214
215PLUGINS := $(PLUGIN_OBJS:.o=.so) 215PLUGINS := $(PLUGIN_OBJS:.o=.so)
216 216
diff --git a/plugin_jbd2.c b/plugin_jbd2.c
new file mode 100644
index 0000000..4ee32de
--- /dev/null
+++ b/plugin_jbd2.c
@@ -0,0 +1,69 @@
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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 */
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24
25#include "parse-events.h"
26
27#define MINORBITS 20
28#define MINORMASK ((1U << MINORBITS) - 1)
29
30#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
31#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
32
33unsigned long long process_jbd2_dev_to_name(struct trace_seq *s,
34 unsigned long long *args)
35{
36 unsigned int dev = args[0];
37
38 trace_seq_printf(s, "%d:%d", MAJOR(dev), MINOR(dev));
39
40 return 0;
41}
42
43unsigned long long process_jiffies_to_msecs(struct trace_seq *s,
44 unsigned long long *args)
45{
46 unsigned long long jiffies = args[0];
47
48 trace_seq_printf(s, "%lld", jiffies);
49
50 return jiffies;
51}
52
53int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
54{
55 pevent_register_print_function(pevent,
56 process_jbd2_dev_to_name,
57 PEVENT_FUNC_ARG_STRING,
58 "jbd2_dev_to_name",
59 PEVENT_FUNC_ARG_INT,
60 PEVENT_FUNC_ARG_VOID);
61
62 pevent_register_print_function(pevent,
63 process_jiffies_to_msecs,
64 PEVENT_FUNC_ARG_LONG,
65 "jiffies_to_msecs",
66 PEVENT_FUNC_ARG_LONG,
67 PEVENT_FUNC_ARG_VOID);
68 return 0;
69}