[36/38] trace-cmd record: Allow instances to be recorded over the network
diff mbox series

Message ID 20180103175340.069022754@goodmis.org
State New, archived
Headers show
Series
  • trace-cmd: Simplify the msg handling
Related show

Commit Message

Steven Rostedt Jan. 3, 2018, 5:52 p.m. UTC
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Allow buffer instances to be used when recording to another machine.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 trace-record.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/trace-record.c b/trace-record.c
index 5f7231b0fda2..e0dd5570a536 100644
--- a/trace-record.c
+++ b/trace-record.c
@@ -2629,10 +2629,6 @@  static int create_recorder(struct buffer_instance *instance, int cpu,
 	char *file;
 	int pid;
 
-	/* network for buffer instances not supported yet */
-	if (client_ports && instance->name)
-		return 0;
-
 	if (type != TRACE_TYPE_EXTRACT) {
 		signal(SIGUSR1, flush);
 
@@ -2651,8 +2647,18 @@  static int create_recorder(struct buffer_instance *instance, int cpu,
 	}
 
 	if (client_ports) {
+		char *path;
+
 		connect_port(cpu);
-		recorder = tracecmd_create_recorder_fd(client_ports[cpu], cpu, recorder_flags);
+		if (instance->name)
+			path = get_instance_dir(instance);
+		else
+			path = tracecmd_find_tracing_dir();
+		recorder = tracecmd_create_buffer_recorder_fd(client_ports[cpu],
+							      cpu, recorder_flags,
+							      path);
+		if (instance->name)
+			tracecmd_put_tracing_file(path);
 	} else {
 		file = get_temp_file(instance, cpu);
 		recorder = create_recorder_instance(instance, file, cpu, brass);