diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-11-26 02:30:03 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-11-26 02:30:03 -0500 |
commit | 0cc34d3e53cd97aa4f446b7ac8f4242a8f3c6fce (patch) | |
tree | 9e1230e95169065b54ca2ed358a92af3ba7c4fe0 | |
parent | 9ebd818d51547b98c108db1a8b8a70b72027613b (diff) |
Keep the full offset and size of a cpu buffer in the file around
The offset and size of the cpu buffer in the file will be referenced
after intial reading. Add file_offset and file_size in the cpu_data
structure to keep it around.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-input.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/trace-input.c b/trace-input.c index b1e98d5..a0becfc 100644 --- a/trace-input.c +++ b/trace-input.c | |||
@@ -20,6 +20,9 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | struct cpu_data { | 22 | struct cpu_data { |
23 | /* the first two never change */ | ||
24 | unsigned long long file_offset; | ||
25 | unsigned long long file_size; | ||
23 | unsigned long long offset; | 26 | unsigned long long offset; |
24 | unsigned long long size; | 27 | unsigned long long size; |
25 | unsigned long long timestamp; | 28 | unsigned long long timestamp; |
@@ -805,9 +808,17 @@ int tracecmd_init_data(struct tracecmd_handle *handle) | |||
805 | memset(handle->cpu_data, 0, sizeof(*handle->cpu_data) * handle->cpus); | 808 | memset(handle->cpu_data, 0, sizeof(*handle->cpu_data) * handle->cpus); |
806 | 809 | ||
807 | for (cpu = 0; cpu < handle->cpus; cpu++) { | 810 | for (cpu = 0; cpu < handle->cpus; cpu++) { |
811 | unsigned long long offset; | ||
812 | |||
808 | handle->cpu_data[cpu].cpu = cpu; | 813 | handle->cpu_data[cpu].cpu = cpu; |
809 | handle->cpu_data[cpu].offset = read8(handle); | 814 | |
810 | handle->cpu_data[cpu].size = read8(handle); | 815 | offset = read8(handle); |
816 | size = read8(handle); | ||
817 | |||
818 | handle->cpu_data[cpu].offset = offset; | ||
819 | handle->cpu_data[cpu].size = size; | ||
820 | handle->cpu_data[cpu].file_offset = offset; | ||
821 | handle->cpu_data[cpu].file_size = size; | ||
811 | 822 | ||
812 | if (init_cpu(handle, cpu)) | 823 | if (init_cpu(handle, cpu)) |
813 | return -1; | 824 | return -1; |