aboutsummaryrefslogtreecommitdiffstats
path: root/trace-read.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-07-17 20:09:42 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-07-17 20:09:42 -0400
commita2f4f2ba59bc76f1700f5583017bff342a722223 (patch)
treec8eacfce09f6b12a408d33ab699374279207d47f /trace-read.c
parentd52dd1f4601dc2c1de730b52c3e00267740b79c5 (diff)
parse header_page from tracing/events directory
Parse out the header_page from the tracing/events directory to get the page header offsets and sizes. We can also use the "commit" field to get the long size of the kernel, incase the kernel and the userspace have different word sizes. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'trace-read.c')
-rw-r--r--trace-read.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/trace-read.c b/trace-read.c
index 91054b8..7b3824c 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -162,8 +162,15 @@ static void read_header_files(void)
162 size = read8(); 162 size = read8();
163 header_page = malloc_or_die(size); 163 header_page = malloc_or_die(size);
164 read_or_die(header_page, size); 164 read_or_die(header_page, size);
165 parse_header_page(header_page, size);
165 free(header_page); 166 free(header_page);
166 167
168 /*
169 * The size field in the page is of type long,
170 * use that instead, since it represents the kernel.
171 */
172 long_size = header_page_size_size;
173
167 read_or_die(buf, 13); 174 read_or_die(buf, 13);
168 if (memcmp(buf, "header_event", 13) != 0) 175 if (memcmp(buf, "header_event", 13) != 0)
169 die("did not read header event"); 176 die("did not read header event");
@@ -377,9 +384,11 @@ struct record *peak_data(int cpu)
377 384
378 if (!index) { 385 if (!index) {
379 /* FIXME: handle header page */ 386 /* FIXME: handle header page */
387 if (header_page_ts_size != 8)
388 die("expected a long long type for timestamp");
380 cpu_data[cpu].timestamp = data2host8(ptr); 389 cpu_data[cpu].timestamp = data2host8(ptr);
381 ptr += 8; 390 ptr += 8;
382 switch (long_size) { 391 switch (header_page_size_size) {
383 case 4: 392 case 4:
384 cpu_data[cpu].page_size = data2host4(ptr); 393 cpu_data[cpu].page_size = data2host4(ptr);
385 ptr += 4; 394 ptr += 4;
@@ -391,6 +400,7 @@ struct record *peak_data(int cpu)
391 default: 400 default:
392 die("bad long size"); 401 die("bad long size");
393 } 402 }
403 ptr = cpu_data[cpu].page + header_page_data_offset;
394 } 404 }
395 405
396read_again: 406read_again: