diff options
| author | Jan Kiszka <jan.kiszka@siemens.com> | 2014-06-12 22:10:04 -0400 |
|---|---|---|
| committer | Jiri Olsa <jolsa@kernel.org> | 2014-06-19 12:18:20 -0400 |
| commit | 6f21037b3295d4ba20ad2cc7cd4073ec64440f8f (patch) | |
| tree | 028cca25c48254645d06f54050b766436809371b /tools/lib | |
| parent | 20d3cbd75ef17b96dfb4f5f1600c0278d330f5ca (diff) | |
tools lib traceevent: Factor out print_exit_reason in kvm plugin
We will reuse it for nested vmexit tracepoints.
Link: http://lkml.kernel.org/r/619c418c8af87f03027b8c8013b0443996605700.1388855989.git.jan.kiszka@web.de
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/traceevent/plugin_kvm.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/lib/traceevent/plugin_kvm.c b/tools/lib/traceevent/plugin_kvm.c index 3e6122067d67..2d7d1d7df0a8 100644 --- a/tools/lib/traceevent/plugin_kvm.c +++ b/tools/lib/traceevent/plugin_kvm.c | |||
| @@ -244,15 +244,14 @@ static const char *find_exit_reason(unsigned isa, int val) | |||
| 244 | return strings[i].str; | 244 | return strings[i].str; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | 247 | static int print_exit_reason(struct trace_seq *s, struct pevent_record *record, |
| 248 | struct event_format *event, void *context) | 248 | struct event_format *event, const char *field) |
| 249 | { | 249 | { |
| 250 | unsigned long long isa; | 250 | unsigned long long isa; |
| 251 | unsigned long long val; | 251 | unsigned long long val; |
| 252 | unsigned long long info1 = 0, info2 = 0; | ||
| 253 | const char *reason; | 252 | const char *reason; |
| 254 | 253 | ||
| 255 | if (pevent_get_field_val(s, event, "exit_reason", record, &val, 1) < 0) | 254 | if (pevent_get_field_val(s, event, field, record, &val, 1) < 0) |
| 256 | return -1; | 255 | return -1; |
| 257 | 256 | ||
| 258 | if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) | 257 | if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0) |
| @@ -263,6 +262,16 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | |||
| 263 | trace_seq_printf(s, "reason %s", reason); | 262 | trace_seq_printf(s, "reason %s", reason); |
| 264 | else | 263 | else |
| 265 | trace_seq_printf(s, "reason UNKNOWN (%llu)", val); | 264 | trace_seq_printf(s, "reason UNKNOWN (%llu)", val); |
| 265 | return 0; | ||
| 266 | } | ||
| 267 | |||
| 268 | static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record, | ||
| 269 | struct event_format *event, void *context) | ||
| 270 | { | ||
| 271 | unsigned long long info1 = 0, info2 = 0; | ||
| 272 | |||
| 273 | if (print_exit_reason(s, record, event, "exit_reason") < 0) | ||
| 274 | return -1; | ||
| 266 | 275 | ||
| 267 | pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); | 276 | pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1); |
| 268 | 277 | ||
