diff mbox series

[14/26] trace-cmd record: Pass cpu_count instead of an instance to stop_mapping_vcpus()

Message ID 20220514024756.1319681-15-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit 8e3a91e19a5818d0208eea27f04e0c32eeb4b5bb
Headers show
Series trace-cmd: Add agent proxy (agent on the host) | expand

Commit Message

Steven Rostedt May 14, 2022, 2:47 a.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The stop_mapping_vcpus() takes an instance as a parameter just to get to
the cpu_count. There's no reason to not just pass the cpu_count instead.
This will also simplify the code when adding an agent proxy that will use
this code as well.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index 8b6b27595c96..f05ad09c9723 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -3920,8 +3920,7 @@  static int map_vcpus(struct tep_event *event, struct tep_record *record,
 	return i == tmap->max_cpus;
 }
 
-static void stop_mapping_vcpus(struct buffer_instance *instance,
-			       struct trace_guest *guest)
+static void stop_mapping_vcpus(int cpu_count, struct trace_guest *guest)
 {
 	struct trace_mapping tmap = { };
 	struct tep_handle *tep;
@@ -3932,7 +3931,7 @@  static void stop_mapping_vcpus(struct buffer_instance *instance,
 		return;
 
 	tmap.pids = guest->task_pids;
-	tmap.max_cpus = instance->cpu_count;
+	tmap.max_cpus = cpu_count;
 
 	tmap.map = malloc(sizeof(*tmap.map) * tmap.max_cpus);
 	if (!tmap.map)
@@ -4010,7 +4009,7 @@  static int host_tsync(struct common_record_context *ctx,
 						    instance->cpu_count,
 						    proto, ctx->clock);
 	if (!is_network(instance))
-		stop_mapping_vcpus(instance, guest);
+		stop_mapping_vcpus(instance->cpu_count, guest);
 
 	if (!instance->tsync)
 		return -1;