diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-11-25 05:48:48 -0500 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2009-11-25 06:16:01 -0500 |
commit | d1c3ee02de911cc987df1cee8644ac4b78a61427 (patch) | |
tree | 0236495783c02bf3b1839d2c38a816874858c220 | |
parent | 892ad67e0df583222ac86bef5419335094c68837 (diff) |
hrtimer_plugin: handle name "timer"
On my machine the field is called just "timer", not "hrtimer",
so handle that (silently).
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
-rw-r--r-- | plugin_hrtimer.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/plugin_hrtimer.c b/plugin_hrtimer.c index f3abd41..3b921ad 100644 --- a/plugin_hrtimer.c +++ b/plugin_hrtimer.c | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | #include "parse-events.h" | 5 | #include "parse-events.h" |
6 | 6 | ||
7 | static int get_offset(struct trace_seq *s, struct event *event, char *name) | 7 | static int _get_offset(struct event *event, char *name) |
8 | { | 8 | { |
9 | struct format_field *field; | 9 | struct format_field *field; |
10 | 10 | ||
@@ -12,10 +12,19 @@ static int get_offset(struct trace_seq *s, struct event *event, char *name) | |||
12 | if (field) | 12 | if (field) |
13 | return field->offset; | 13 | return field->offset; |
14 | 14 | ||
15 | trace_seq_printf(s, "CAN'T FIND FIELD \"%s\"", name); | ||
16 | return -1; | 15 | return -1; |
17 | } | 16 | } |
18 | 17 | ||
18 | static int get_offset(struct trace_seq *s, struct event *event, char *name) | ||
19 | { | ||
20 | int r = _get_offset(event, name); | ||
21 | |||
22 | if (r < 0) | ||
23 | trace_seq_printf(s, "CAN'T FIND FIELD \"%s\"", name); | ||
24 | |||
25 | return r; | ||
26 | } | ||
27 | |||
19 | static int timer_expire_handler(struct trace_seq *s, void *data, int size, | 28 | static int timer_expire_handler(struct trace_seq *s, void *data, int size, |
20 | struct event *event) | 29 | struct event *event) |
21 | { | 30 | { |
@@ -24,7 +33,9 @@ static int timer_expire_handler(struct trace_seq *s, void *data, int size, | |||
24 | int offset; | 33 | int offset; |
25 | int ret; | 34 | int ret; |
26 | 35 | ||
27 | offset = get_offset(s, event, "hrtimer"); | 36 | offset = _get_offset(event, "timer"); |
37 | if (offset < 0) | ||
38 | offset = get_offset(s, event, "hrtimer"); | ||
28 | if (offset < 0) | 39 | if (offset < 0) |
29 | return 0; | 40 | return 0; |
30 | hrtimer = *(void **)(data + offset); | 41 | hrtimer = *(void **)(data + offset); |
@@ -50,7 +61,9 @@ static int timer_start_handler(struct trace_seq *s, void *data, int size, | |||
50 | int offset; | 61 | int offset; |
51 | int ret; | 62 | int ret; |
52 | 63 | ||
53 | offset = get_offset(s, event, "hrtimer"); | 64 | offset = _get_offset(event, "timer"); |
65 | if (offset < 0) | ||
66 | offset = get_offset(s, event, "hrtimer"); | ||
54 | if (offset < 0) | 67 | if (offset < 0) |
55 | return 0; | 68 | return 0; |
56 | hrtimer = *(void **)(data + offset); | 69 | hrtimer = *(void **)(data + offset); |