diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2009-12-22 21:32:56 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-22 21:32:56 -0500 |
commit | 1bb26c35791bade1335cbec5861001d95b016cf5 (patch) | |
tree | 8968bf427d4ff2dc6ea516cfef8693e72b968ab6 | |
parent | d878752485c9a3e482f194a3c9cbc893254c1b8f (diff) | |
parent | 9a29217ec2a13685127d8105e44feb461cc67c56 (diff) |
Merge branch 'trace-cmd' into trace-view
-rw-r--r-- | parse-events.c | 36 | ||||
-rw-r--r-- | parse-events.h | 3 | ||||
-rw-r--r-- | trace-input.c | 9 |
3 files changed, 34 insertions, 14 deletions
diff --git a/parse-events.c b/parse-events.c index eabce41..0600973 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 | } |
@@ -3520,13 +3536,15 @@ static void parse_header_field(const char *field, | |||
3520 | * @pevent: the handle to the pevent | 3536 | * @pevent: the handle to the pevent |
3521 | * @buf: the buffer storing the header page format string | 3537 | * @buf: the buffer storing the header page format string |
3522 | * @size: the size of @buf | 3538 | * @size: the size of @buf |
3539 | * @long_size: the long size to use if there is no header | ||
3523 | * | 3540 | * |
3524 | * This parses the header page format for information on the | 3541 | * This parses the header page format for information on the |
3525 | * ring buffer used. The @buf should be copied from | 3542 | * ring buffer used. The @buf should be copied from |
3526 | * | 3543 | * |
3527 | * /sys/kernel/debug/tracing/events/header_page | 3544 | * /sys/kernel/debug/tracing/events/header_page |
3528 | */ | 3545 | */ |
3529 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size) | 3546 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, |
3547 | int long_size) | ||
3530 | { | 3548 | { |
3531 | if (!size) { | 3549 | if (!size) { |
3532 | /* | 3550 | /* |
@@ -3534,10 +3552,10 @@ int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long siz | |||
3534 | * Sorry but we just use what we find here in user space. | 3552 | * Sorry but we just use what we find here in user space. |
3535 | */ | 3553 | */ |
3536 | pevent->header_page_ts_size = sizeof(long long); | 3554 | pevent->header_page_ts_size = sizeof(long long); |
3537 | pevent->header_page_size_size = sizeof(long); | 3555 | pevent->header_page_size_size = long_size; |
3538 | pevent->header_page_data_offset = sizeof(long long) + sizeof(long); | 3556 | pevent->header_page_data_offset = sizeof(long long) + long_size; |
3539 | pevent->old_format = 1; | 3557 | pevent->old_format = 1; |
3540 | return 0; | 3558 | return -1; |
3541 | } | 3559 | } |
3542 | init_input_buf(buf, size); | 3560 | init_input_buf(buf, size); |
3543 | 3561 | ||
diff --git a/parse-events.h b/parse-events.h index 00bdc44..92f174e 100644 --- a/parse-events.h +++ b/parse-events.h | |||
@@ -352,7 +352,8 @@ int pevent_pid_is_registered(struct pevent *pevent, int pid); | |||
352 | void pevent_print_event(struct pevent *pevent, struct trace_seq *s, | 352 | void pevent_print_event(struct pevent *pevent, struct trace_seq *s, |
353 | struct record *record); | 353 | struct record *record); |
354 | 354 | ||
355 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size); | 355 | int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size, |
356 | int long_size); | ||
356 | 357 | ||
357 | int pevent_parse_event(struct pevent *pevent, char *buf, unsigned long size, char *sys); | 358 | int pevent_parse_event(struct pevent *pevent, char *buf, unsigned long size, char *sys); |
358 | 359 | ||
diff --git a/trace-input.c b/trace-input.c index 8cc8865..c55e94f 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -200,7 +200,7 @@ static int read_header_files(struct tracecmd_input *handle) | |||
200 | if (do_read_check(handle, header, size)) | 200 | if (do_read_check(handle, header, size)) |
201 | goto failed_read; | 201 | goto failed_read; |
202 | 202 | ||
203 | pevent_parse_header_page(pevent, header, size); | 203 | pevent_parse_header_page(pevent, header, size, handle->long_size); |
204 | free(header); | 204 | free(header); |
205 | 205 | ||
206 | /* | 206 | /* |
@@ -1144,9 +1144,10 @@ tracecmd_peek_data(struct tracecmd_input *handle, int cpu) | |||
1144 | 1144 | ||
1145 | if (handle->cpu_data[cpu].next) { | 1145 | if (handle->cpu_data[cpu].next) { |
1146 | /* Make sure it's still mapped */ | 1146 | /* Make sure it's still mapped */ |
1147 | ret = tracecmd_refresh_record(handle, handle->cpu_data[cpu].next); | 1147 | record = handle->cpu_data[cpu].next; |
1148 | ret = tracecmd_refresh_record(handle, record); | ||
1148 | if (ret < 0) { | 1149 | if (ret < 0) { |
1149 | free_record(handle->cpu_data[cpu].next); | 1150 | free_record(record); |
1150 | handle->cpu_data[cpu].next = NULL; | 1151 | handle->cpu_data[cpu].next = NULL; |
1151 | return NULL; | 1152 | return NULL; |
1152 | } | 1153 | } |
@@ -1160,7 +1161,7 @@ tracecmd_peek_data(struct tracecmd_input *handle, int cpu) | |||
1160 | record->record_size; | 1161 | record->record_size; |
1161 | handle->cpu_data[cpu].timestamp = record->ts; | 1162 | handle->cpu_data[cpu].timestamp = record->ts; |
1162 | } | 1163 | } |
1163 | return handle->cpu_data[cpu].next; | 1164 | return record; |
1164 | } | 1165 | } |
1165 | 1166 | ||
1166 | if (!page) | 1167 | if (!page) |