linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Subject: [PATCH 2/2] trace-cmd report: Add last_timestamp array for instances
Date: Fri, 05 Mar 2021 17:47:21 -0500	[thread overview]
Message-ID: <20210305224750.351786306@goodmis.org> (raw)
In-Reply-To: 20210305224719.784797597@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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@goodmis.org>
---
 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



      parent reply	other threads:[~2021-03-05 22:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 22:47 [PATCH 0/2] trace-cmd: Fixes for instance recording and reporting Steven Rostedt
2021-03-05 22:47 ` [PATCH 1/2] trace-cmd record: Allow tracecmd_write_cpu_data() be called multiple times Steven Rostedt
2021-03-05 22:47 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210305224750.351786306@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).