[PATCH 2/2] trace-cmd report: Add last_timestamp array for instances

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

The logic to add a last_timestamp array to the reading of trace data for
multiple files failed to include the array for instances within a given
file. This caused the instance handles not to have a way to save the last
timestamp, and caused the output to quit due to reading a record on a CPU
past the last CPU in the last_timestamp array.

Fixes: db36a61d2 ("trace-cmd: Fix last_timestamp logic to handle multiple files")
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 tracecmd/trace-read.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index ce07b6bdb143..56fc0626d486 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -1205,6 +1205,12 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
 	list_for_each_entry(handles, handle_list, list) {
 		int cpus;
 
+		cpus = tracecmd_cpus(handles->handle);
+		handles->cpus = cpus;
+		handles->last_timestamp = calloc(cpus, sizeof(*handles->last_timestamp));
+		if (!handles->last_timestamp)
+			die("allocating timestamps");
+
 		/* Don't process instances that we added here */
 		if (tracecmd_is_buffer_instance(handles->handle))
 			continue;
@@ -1213,15 +1219,9 @@ static void read_data_info(struct list_head *handle_list, enum output_type otype
 		if (ret < 0)
 			die("failed to init data");
 
-		cpus = tracecmd_cpus(handles->handle);
-		handles->cpus = cpus;
 		print_handle_file(handles);
 		printf("cpus=%d\n", cpus);
 
-		handles->last_timestamp = calloc(cpus, sizeof(*handles->last_timestamp));
-		if (!handles->last_timestamp)
-			die("allocating timestamps");
-
 		/* Latency trace is just all ASCII */
 		if (ret > 0) {
 			if (multi_inputs)
-- 
2.30.0





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux