aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2009-12-22 21:28:09 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-22 21:28:09 -0500
commit9a29217ec2a13685127d8105e44feb461cc67c56 (patch)
treed8345107099033379a46ba3046462c637d120789
parent05bf395176c1b9887e60f3cb39c6a2b7c6703015 (diff)
trace-cmd: Use file long size if no header page is found
Use the long size of the trace.dat file if no header page is found, instead of using the long size of the host that is running the report. It makes more sense to use the long size that the record was running on than to read the host. This way it at least breaks on all boxes and not just some. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c10
-rw-r--r--parse-events.h3
-rw-r--r--trace-input.c2
3 files changed, 9 insertions, 6 deletions
diff --git a/parse-events.c b/parse-events.c
index 30d3ea0..0600973 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -3536,13 +3536,15 @@ static void parse_header_field(const char *field,
3536 * @pevent: the handle to the pevent 3536 * @pevent: the handle to the pevent
3537 * @buf: the buffer storing the header page format string 3537 * @buf: the buffer storing the header page format string
3538 * @size: the size of @buf 3538 * @size: the size of @buf
3539 * @long_size: the long size to use if there is no header
3539 * 3540 *
3540 * This parses the header page format for information on the 3541 * This parses the header page format for information on the
3541 * ring buffer used. The @buf should be copied from 3542 * ring buffer used. The @buf should be copied from
3542 * 3543 *
3543 * /sys/kernel/debug/tracing/events/header_page 3544 * /sys/kernel/debug/tracing/events/header_page
3544 */ 3545 */
3545int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size) 3546int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size,
3547 int long_size)
3546{ 3548{
3547 if (!size) { 3549 if (!size) {
3548 /* 3550 /*
@@ -3550,10 +3552,10 @@ int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long siz
3550 * 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.
3551 */ 3553 */
3552 pevent->header_page_ts_size = sizeof(long long); 3554 pevent->header_page_ts_size = sizeof(long long);
3553 pevent->header_page_size_size = sizeof(long); 3555 pevent->header_page_size_size = long_size;
3554 pevent->header_page_data_offset = sizeof(long long) + sizeof(long); 3556 pevent->header_page_data_offset = sizeof(long long) + long_size;
3555 pevent->old_format = 1; 3557 pevent->old_format = 1;
3556 return 0; 3558 return -1;
3557 } 3559 }
3558 init_input_buf(buf, size); 3560 init_input_buf(buf, size);
3559 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);
352void pevent_print_event(struct pevent *pevent, struct trace_seq *s, 352void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
353 struct record *record); 353 struct record *record);
354 354
355int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size); 355int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size,
356 int long_size);
356 357
357int pevent_parse_event(struct pevent *pevent, char *buf, unsigned long size, char *sys); 358int 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 d00d8c9..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 /*