Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp12851969pxu; Sat, 2 Jan 2021 14:09:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1knrvNNoRASzIJAkiUKso4J5V1saUcEO0Li1ZIXZ5SxfiuovHMc1G6iTgdaFenoZ0GQEu X-Received: by 2002:a17:906:3b5b:: with SMTP id h27mr60625589ejf.450.1609625368463; Sat, 02 Jan 2021 14:09:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609625368; cv=none; d=google.com; s=arc-20160816; b=B8cBDCT/3vyZPrA5y6eSdARXURDRC1hQV5kr1DVzsey75Zte//6pydsYf88kBh5rLU +VO9H0EYWLitYMM2eqtdMBHcq0HFTRH1TPpohgASn5B4I8en7gwlWaZGUs/B+G/1hYdI xSwagYSMI1/p064R9yZx+HqH+srnRAGsLC0lyIf5aWQ6541B3wLEmbWniNd1/2y364Gl G+4Qtnigjjh83ZKQHu/Fcr7T3ofy6Lb9KiVjRZ3IH64qt+yfGXqzfHvBftLGkojOUOpg ZbSt/u8F39Rsk0gR7fdQDojCWHJfGw4eHiKUA5lKffy82KD9wV8ByZzc+4lZq02gVjVq UQhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=NO4RIcyk3UEYX/5DeG3XCAl6tCTZIa89bg8mvtu5iy0=; b=tyjlOnMH4c3+E5lA2ziFkTQvR433sPmZTOdyNe5b73yJv9ItzhdPwSuEKLepBSiv0F 4qGlEKCJdjAnMVjjqsZqkjuG5mdMZ1qs/nF43Ir7x8rzyo5fCW2NGmyTKXOg3Le5381Z hv+SQZWoPVG9PUOIo0eQb6qKhN6zsKaNqrMnPPS9ZVrqe1DrGRohXf8xQAxSYzAF4uye dWBL7+iRle0FDCEObGJ63eA1MyrYpR7drum085Y88cjtrvj05lRSMWfnmsfKSp2GVWZE dZ4I78lI7MVt6094q8ghyo6ukE+QhFMucH7TNk11Ze4cI0OmiOhec6JKB9xFiFSNHpq/ cMQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qn10si27216438ejb.591.2021.01.02.14.09.05; Sat, 02 Jan 2021 14:09:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727374AbhABWG3 convert rfc822-to-8bit (ORCPT + 99 others); Sat, 2 Jan 2021 17:06:29 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:39264 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbhABWG2 (ORCPT ); Sat, 2 Jan 2021 17:06:28 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-nxm3-xakMWWB9WcPQPnwqg-1; Sat, 02 Jan 2021 17:05:31 -0500 X-MC-Unique: nxm3-xakMWWB9WcPQPnwqg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C75E59; Sat, 2 Jan 2021 22:05:29 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C66C1A353; Sat, 2 Jan 2021 22:05:27 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: [PATCH 13/22] perf daemon: Set control fifo for session Date: Sat, 2 Jan 2021 23:04:32 +0100 Message-Id: <20210102220441.794923-14-jolsa@kernel.org> In-Reply-To: <20210102220441.794923-1-jolsa@kernel.org> References: <20210102220441.794923-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Setup control fifos for session and add --control option to session arguments. Example: # cat ~/.perfconfig [daemon] base=/opt/perfdata [session-cycles] run = -m 10M -e cycles --overwrite --switch-output -a [session-sched] run = -m 20M -e sched:* --overwrite --switch-output -a Starting the daemon: # perf daemon start Use can list control fifos with (control and ack files): # perf daemon -v [776459:daemon] base: /opt/perfdata output: /opt/perfdata/output lock: /opt/perfdata/lock [776460:cycles] perf record -m 20M -e cycles --overwrite --switch-output -a base: /opt/perfdata/session-cycles output: /opt/perfdata/session-cycles/output control: /opt/perfdata/session-cycles/control ack: /opt/perfdata/session-cycles/ack [776461:sched] perf record -m 20M -e sched:* --overwrite --switch-output -a base: /opt/perfdata/session-sched output: /opt/perfdata/session-sched/output control: /opt/perfdata/session-sched/control ack: /opt/perfdata/session-sched/ack Signed-off-by: Jiri Olsa --- tools/perf/builtin-daemon.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c index 1982eedd3f3f..0c82fe9603e8 100644 --- a/tools/perf/builtin-daemon.c +++ b/tools/perf/builtin-daemon.c @@ -35,6 +35,8 @@ #include #define SESSION_OUTPUT "output" +#define SESSION_CONTROL "control" +#define SESSION_ACK "ack" enum session_state { SESSION_STATE__OK, @@ -46,6 +48,7 @@ struct session { char *base; char *name; char *run; + char *control; int pid; struct list_head list; enum session_state state; @@ -288,7 +291,18 @@ static int session__run(struct session *session, struct daemon *daemon) dup2(fd, 2); close(fd); - scnprintf(buf, sizeof(buf), "%s record %s", daemon->perf, session->run); + if (mkfifo(SESSION_CONTROL, O_RDWR) && errno != EEXIST) { + perror("failed to create control fifo"); + return -1; + } + + if (mkfifo(SESSION_ACK, O_RDWR) && errno != EEXIST) { + perror("failed to create ack fifo"); + return -1; + } + + scnprintf(buf, sizeof(buf), "%s record --control=fifo:%s,%s %s", + daemon->perf, SESSION_CONTROL, SESSION_ACK, session->run); argv = argv_split(buf, &argc); if (!argv) @@ -594,6 +608,12 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) /* session output */ csv_sep, session->base, SESSION_OUTPUT); + fprintf(out, "%c%s/%s%c%s/%s", + /* session control */ + csv_sep, session->base, SESSION_CONTROL, + /* session ack */ + csv_sep, session->base, SESSION_ACK); + fprintf(out, "\n"); } else { fprintf(out, "[%d:%s] perf record %s\n", @@ -604,6 +624,10 @@ static int cmd_session_list(struct daemon *daemon, union cmd *cmd, FILE *out) session->base); fprintf(out, " output: %s/%s\n", session->base, SESSION_OUTPUT); + fprintf(out, " control: %s/%s\n", + session->base, SESSION_CONTROL); + fprintf(out, " ack: %s/%s\n", + session->base, SESSION_ACK); } } -- 2.26.2