@@ -951,18 +951,20 @@ void trace_show_data(struct tracecmd_input *handle, struct tep_record *record)
printf("\n");
}
-static void read_rest(void)
+static void read_latency(struct tracecmd_input *handle)
{
- char buf[BUFSIZ + 1];
+ char *buf = NULL;
+ size_t size = 0;
int r;
do {
- r = read(input_fd, buf, BUFSIZ);
- if (r > 0) {
- buf[r] = 0;
- printf("%s", buf);
- }
+ r = tracecmd_latency_data_read(handle, &buf, &size);
+ if (r > 0)
+ printf("%.*s", r, buf);
} while (r > 0);
+
+ printf("\n");
+ free(buf);
}
static int
@@ -1246,7 +1248,7 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
if (ret > 0) {
if (multi_inputs)
die("latency traces do not work with multiple inputs");
- read_rest();
+ read_latency(handles->handle);
return;
}
When reading latency trace data, use the new API tracecmd_latency_data_read() It handles reading latency trace data from both version 6 and 7 trace files. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/trace-read.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)