diff options
Diffstat (limited to 'trace-split.c')
| -rw-r--r-- | trace-split.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/trace-split.c b/trace-split.c index 1e25da2..b1fe4de 100644 --- a/trace-split.c +++ b/trace-split.c | |||
| @@ -155,14 +155,15 @@ static int write_record(struct tracecmd_input *handle, | |||
| 155 | return 1; | 155 | return 1; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | static void write_page(struct cpu_data *cpu_data, int long_size) | 158 | static void write_page(struct pevent *pevent, |
| 159 | struct cpu_data *cpu_data, int long_size) | ||
| 159 | { | 160 | { |
| 160 | if (long_size == 8) | 161 | if (long_size == 8) |
| 161 | *(unsigned long long *)cpu_data->commit = | 162 | *(unsigned long long *)cpu_data->commit = |
| 162 | (unsigned long long)cpu_data->index - 16; | 163 | __data2host8(pevent, (unsigned long long)cpu_data->index - 16); |
| 163 | else | 164 | else |
| 164 | *(unsigned int *)cpu_data->commit = | 165 | *(unsigned int *)cpu_data->commit = |
| 165 | cpu_data->index - 12; | 166 | __data2host4(pevent, cpu_data->index - 12); |
| 166 | write(cpu_data->fd, cpu_data->page, page_size); | 167 | write(cpu_data->fd, cpu_data->page, page_size); |
| 167 | } | 168 | } |
| 168 | 169 | ||
| @@ -226,7 +227,7 @@ static int parse_cpu(struct tracecmd_input *handle, | |||
| 226 | while (record && (!end || record->ts <= end)) { | 227 | while (record && (!end || record->ts <= end)) { |
| 227 | if (cpu_data[cpu].index + record->record_size > page_size) { | 228 | if (cpu_data[cpu].index + record->record_size > page_size) { |
| 228 | if (cpu_data[cpu].page) | 229 | if (cpu_data[cpu].page) |
| 229 | write_page(&cpu_data[cpu], long_size); | 230 | write_page(pevent, &cpu_data[cpu], long_size); |
| 230 | else | 231 | else |
| 231 | cpu_data[cpu].page = malloc_or_die(page_size); | 232 | cpu_data[cpu].page = malloc_or_die(page_size); |
| 232 | 233 | ||
| @@ -304,14 +305,14 @@ static int parse_cpu(struct tracecmd_input *handle, | |||
| 304 | 305 | ||
| 305 | if (percpu) { | 306 | if (percpu) { |
| 306 | if (cpu_data[cpu].page) { | 307 | if (cpu_data[cpu].page) { |
| 307 | write_page(&cpu_data[cpu], long_size); | 308 | write_page(pevent, &cpu_data[cpu], long_size); |
| 308 | free(cpu_data[cpu].page); | 309 | free(cpu_data[cpu].page); |
| 309 | cpu_data[cpu].page = NULL; | 310 | cpu_data[cpu].page = NULL; |
| 310 | } | 311 | } |
| 311 | } else { | 312 | } else { |
| 312 | for (cpu = 0; cpu < cpus; cpu++) { | 313 | for (cpu = 0; cpu < cpus; cpu++) { |
| 313 | if (cpu_data[cpu].page) { | 314 | if (cpu_data[cpu].page) { |
| 314 | write_page(&cpu_data[cpu], long_size); | 315 | write_page(pevent, &cpu_data[cpu], long_size); |
| 315 | free(cpu_data[cpu].page); | 316 | free(cpu_data[cpu].page); |
| 316 | cpu_data[cpu].page = NULL; | 317 | cpu_data[cpu].page = NULL; |
| 317 | } | 318 | } |
