aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-11-26 14:32:17 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-11-26 14:32:17 -0500
commit67e19b45283f32e1e215ab08d399c6c9c0ef32a2 (patch)
tree5c4e38a62b7fe1e5d9b560969d0a0c1470d5c668
parent34a9a10e68bafdcb6da29a5c853bf6b6ac393713 (diff)
Add record->record_size to denote actual size of record
Add record->record_size to be used with tracecmd_read_at() to find a record that contains the offset passed in. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-cmd.h3
-rw-r--r--trace-input.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/trace-cmd.h b/trace-cmd.h
index 6324057..be38ef2 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -29,7 +29,8 @@ enum {
29struct record { 29struct record {
30 unsigned long long ts; 30 unsigned long long ts;
31 unsigned long long offset; 31 unsigned long long offset;
32 int size; 32 int record_size; /* size of binary record */
33 int size; /* size of data */
33 void *data; 34 void *data;
34}; 35};
35 36
diff --git a/trace-input.c b/trace-input.c
index 46fb135..299d7dc 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -582,6 +582,8 @@ read_old_format(struct tracecmd_handle *handle, void **ptr, int cpu)
582 handle->cpu_data[cpu].index = calc_index(handle, *ptr, cpu); 582 handle->cpu_data[cpu].index = calc_index(handle, *ptr, cpu);
583 handle->cpu_data[cpu].next = data; 583 handle->cpu_data[cpu].next = data;
584 584
585 data->record_size = handle->cpu_data[cpu].index - index;
586
585 return data; 587 return data;
586} 588}
587 589
@@ -604,7 +606,7 @@ read_event(struct tracecmd_handle *handle, unsigned long long offset,
604 606
605 do { 607 do {
606 record = tracecmd_read_data(handle, cpu); 608 record = tracecmd_read_data(handle, cpu);
607 } while (record && (record->offset + record->size) < offset); 609 } while (record && (record->offset + record->record_size) <= offset);
608 610
609 return record; 611 return record;
610} 612}
@@ -796,6 +798,8 @@ read_again:
796 handle->cpu_data[cpu].index = calc_index(handle, ptr, cpu); 798 handle->cpu_data[cpu].index = calc_index(handle, ptr, cpu);
797 handle->cpu_data[cpu].next = data; 799 handle->cpu_data[cpu].next = data;
798 800
801 data->record_size = handle->cpu_data[cpu].index - index;
802
799 return data; 803 return data;
800} 804}
801 805