All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Ross Zwisler <zwisler@google.com>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 10/11] libtraceveal task-eval: Clean up all traceeval_iterators
Date: Tue, 10 Oct 2023 23:25:26 -0400	[thread overview]
Message-ID: <20231011032640.1804571-11-rostedt@goodmis.org> (raw)
In-Reply-To: <20231011032640.1804571-1-rostedt@goodmis.org>

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

When traceeval_iterator_get() is used, it must be accompanied with a
traceeval_iterator_put().

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 samples/task-eval.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/samples/task-eval.c b/samples/task-eval.c
index 420d87f498cc..25032293c9a3 100644
--- a/samples/task-eval.c
+++ b/samples/task-eval.c
@@ -828,6 +828,8 @@ static void display_cpus(struct traceeval *teval)
 
 	if (last_cpu < 0)
 		die("No result for CPUs\n");
+
+	traceeval_iterator_put(iter);
 }
 
 static void print_stats(int idx, struct traceeval_stat *stat)
@@ -920,6 +922,8 @@ static void display_threads(struct traceeval *teval)
 		display_state_times(state, stat);
 	}
 
+	traceeval_iterator_put(iter);
+
 	if (last_tid < 0)
 		die("No result for threads\n");
 }
@@ -982,12 +986,13 @@ static void display_processes(struct traceeval *teval)
 		if (pdata)
 			display_process(pdata);
 	}
+	traceeval_iterator_put(iter);
 }
 
 static void display(struct task_data *tdata)
 {
 	struct traceeval *teval = tdata->teval_cpus;
-	struct traceeval_iterator *iter = traceeval_iterator_get(teval);
+	struct traceeval_iterator *iter;
 	const struct traceeval_data *keys;
 	struct traceeval_stat *stat;
 	unsigned long long total_time = 0;
@@ -997,6 +1002,8 @@ static void display(struct task_data *tdata)
 		return display_processes(tdata->teval_tasks);
 	}
 
+	iter = traceeval_iterator_get(teval);
+
 	printf("Total:\n");
 
 	if (!iter)
@@ -1021,6 +1028,8 @@ static void display(struct task_data *tdata)
 		}
 	}
 
+	traceeval_iterator_put(iter);
+
 	printf("  Total  run time (us):");
 	print_microseconds_nl(16, total_time);
 	printf("  Total idle time (us):");
-- 
2.42.0


  parent reply	other threads:[~2023-10-11  3:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  3:25 [PATCH 00/11] libtraceeval task-eval: Updates to evaluate tasks Steven Rostedt
2023-10-11  3:25 ` [PATCH 01/11] libtraceeval task-eval: Fix naming conventions of variables Steven Rostedt
2023-10-11  3:25 ` [PATCH 02/11] libtraceeval task-eval: Use "assign_*keys/vals()" helper functions Steven Rostedt
2023-10-11  3:25 ` [PATCH 03/11] libtraceeval task-eval: Add tracking of priority Steven Rostedt
2023-10-11  3:25 ` [PATCH 04/11] libtraceeval task-eval: Add way to read trace.dat buffer instances Steven Rostedt
2023-10-11  3:25 ` [PATCH 05/11] libtraceeval task-eval: Account for ZOMBIE and EXITED states Steven Rostedt
2023-10-11  3:25 ` [PATCH 06/11] libtraceeval task-eval: Show max, min and count of deltas too Steven Rostedt
2023-10-11  3:25 ` [PATCH 07/11] libtraceeval task-eval: Add more comments Steven Rostedt
2023-10-11  3:25 ` [PATCH 08/11] libtraceeval task-eval: Only release results if found Steven Rostedt
2023-10-11  3:25 ` [PATCH 09/11] libtraceeval task-eval: Do not add pdata to non RUNNING tasks Steven Rostedt
2023-10-11  3:25 ` Steven Rostedt [this message]
2023-10-11  3:25 ` [PATCH 11/11] libtraceeval task-evals: Free the libtraceevals Steven Rostedt

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=20231011032640.1804571-11-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=zwisler@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.