diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-12-22 20:51:29 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-22 20:51:29 -0500 |
commit | 18418f6848112ad4b26566bc617ccc12ac4dc6af (patch) | |
tree | 4fd040444c4d26b43512637e57f155684ba20eb1 | |
parent | 50486581f93e196770d3ebbb5a5ed4a9d52d144b (diff) |
parse-events: Make common_lock_depth optional
Some older kernels (and future ones) do not have the lock_depth
field in the event. Make it optional for parsing.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | parse-events.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/parse-events.c b/parse-events.c index eabce41..30d3ea0 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -3116,6 +3116,8 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event | |||
3116 | void pevent_data_lat_fmt(struct pevent *pevent, | 3116 | void pevent_data_lat_fmt(struct pevent *pevent, |
3117 | struct trace_seq *s, struct record *record) | 3117 | struct trace_seq *s, struct record *record) |
3118 | { | 3118 | { |
3119 | static int check_lock_depth = 1; | ||
3120 | static int lock_depth_exists; | ||
3119 | unsigned int lat_flags; | 3121 | unsigned int lat_flags; |
3120 | unsigned int pc; | 3122 | unsigned int pc; |
3121 | int lock_depth; | 3123 | int lock_depth; |
@@ -3125,7 +3127,19 @@ void pevent_data_lat_fmt(struct pevent *pevent, | |||
3125 | 3127 | ||
3126 | lat_flags = parse_common_flags(pevent, data); | 3128 | lat_flags = parse_common_flags(pevent, data); |
3127 | pc = parse_common_pc(pevent, data); | 3129 | pc = parse_common_pc(pevent, data); |
3128 | lock_depth = parse_common_lock_depth(pevent, data); | 3130 | /* lock_depth may not always exist */ |
3131 | if (check_lock_depth) { | ||
3132 | struct format_field *field; | ||
3133 | struct event_format *event; | ||
3134 | |||
3135 | check_lock_depth = 0; | ||
3136 | event = pevent->event_list; | ||
3137 | field = pevent_find_common_field(event, "common_lock_depth"); | ||
3138 | if (field) | ||
3139 | lock_depth_exists = 1; | ||
3140 | } | ||
3141 | if (lock_depth_exists) | ||
3142 | lock_depth = parse_common_lock_depth(pevent, data); | ||
3129 | 3143 | ||
3130 | hardirq = lat_flags & TRACE_FLAG_HARDIRQ; | 3144 | hardirq = lat_flags & TRACE_FLAG_HARDIRQ; |
3131 | softirq = lat_flags & TRACE_FLAG_SOFTIRQ; | 3145 | softirq = lat_flags & TRACE_FLAG_SOFTIRQ; |
@@ -3144,10 +3158,12 @@ void pevent_data_lat_fmt(struct pevent *pevent, | |||
3144 | else | 3158 | else |
3145 | trace_seq_putc(s, '.'); | 3159 | trace_seq_putc(s, '.'); |
3146 | 3160 | ||
3147 | if (lock_depth < 0) | 3161 | if (lock_depth_exists) { |
3148 | trace_seq_putc(s, '.'); | 3162 | if (lock_depth < 0) |
3149 | else | 3163 | trace_seq_putc(s, '.'); |
3150 | trace_seq_printf(s, "%d", lock_depth); | 3164 | else |
3165 | trace_seq_printf(s, "%d", lock_depth); | ||
3166 | } | ||
3151 | 3167 | ||
3152 | trace_seq_terminate(s); | 3168 | trace_seq_terminate(s); |
3153 | } | 3169 | } |