Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3473229pxu; Tue, 15 Dec 2020 07:50:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzw63xYJJL8yx0XMWAbzXOox9TWFCJ7VEhqssvZjzQtoITTZVpzfH/hphrBN4aJzwPdB2kN X-Received: by 2002:a05:6402:1765:: with SMTP id da5mr30673348edb.27.1608047429912; Tue, 15 Dec 2020 07:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608047429; cv=none; d=google.com; s=arc-20160816; b=iNKfWc6E3VwYrSE5ZvnhNI7qXxcIdE4DubtSefIbHIAWxBsWTve+yw+fNxDC1RUI+L xFw2ZhW3QsLVE/VzTdrU2+YKtj2C+CeA5FM0VXiLkf8pgdntn23J8JsMBd2PJKyxnwOz 6EW2V7cl5OS8BsBckgS9okxhxCscW7a4k4haQArDfYogNaMiUmQ9VJ/U2j4/wRNnZ/oK Pr8qfoE3krGNkSz1w9FTRkPvYhKs0MtLjoU97Fh39sD0A7/Ki7ZM9UXTm74KbTdZCzNL 6fwENUAZN28PNUyTmc3Tw3PHD41kA2b7xCN8VXGJJWCbidxbnhBnxeGo1iF+IFH1RdAx 7xrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=rJHKJuaq+nusD5T/MJNctMgxYUSushRXKRiz7sLXYPk=; b=Nnd3Qj23Tl5WihQCCCcSxiOtDTSdFF0lfoDoJUHUORuFy6VoZFpO2viuVEviDiwKbq v9rG8/TbubH3+eR/uqfzA8TAZN9OyRGEKR2ITPv/CsbykKLFCRiQy2iz/VAHgANjC7fI kxNzzgW3+8hQedvb2TCAps1YVN0TqJZ+54ZBhAJ9irNLcyPFLIiuBRHZK+CyEa0v7XDQ cviTJVcHfLuUYii2VAuyHXlvsjQW11EoWv8+S0HOEqWAQ7q96RNNIyhKdCi5O9z+M7Lt +8tpwMju8JS7UZwCTOxaDaeMNqmpR7AzzDe0Y1gyqgyNGmnq8vRLIdNXUc5SMKWFGZ5Y Gy2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k7MbQg0w; 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 en21si1185835ejc.393.2020.12.15.07.50.06; Tue, 15 Dec 2020 07:50:29 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k7MbQg0w; 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 S1730423AbgLOPqg (ORCPT + 99 others); Tue, 15 Dec 2020 10:46:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:39572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbgLOPqO (ORCPT ); Tue, 15 Dec 2020 10:46:14 -0500 Date: Tue, 15 Dec 2020 12:45:46 -0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1608047133; bh=/NofofITGR9fSTQ0qpGr+6v4fzgf491DpFUoiBT/IIw=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=k7MbQg0wNYzEH16hPsCideeheltrB9EAnz1QHt+colGaytBTFBE6+e85l9fm1fF9C gJ0jkU3+F4Nsjj6bP7IuR/NjtKcXsFNFL/pi04xMAgfaXacBxjiaXgAkC1iSi2ctDi G6YSrgBhvNZVsFfDleMJFUVQAgo8UTrJLnVzldatR8ccBrZq0rcK/Ts4MrZA4bI6gM y9z1ajMnU+kX/GsAGUP+9iHNDKscq1gDUmawAoXHQrj3y/oMHU2Fe0YyQyrtIcBh7d 6YnQrwwGRF+f+BFTCWZXUQnCgWsNtF2fCno6PLjY6NNYwjt5pTFgBaATXziu54/PwL 1HNW4tXA6mlIg== From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Stephane Eranian , Alexei Budankov Subject: Re: [PATCH 6/8] perf daemon: Add stop command Message-ID: <20201215154546.GG258566@kernel.org> References: <20201212104358.412065-1-jolsa@kernel.org> <20201212104358.412065-7-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201212104358.412065-7-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Dec 12, 2020 at 11:43:56AM +0100, Jiri Olsa escreveu: > Allow 'perf daemon' to stop daemon process: > > # perf daemon --stop > perf daemon is exciting It looks exciting, yes, a nice functionality! ;-) - Arnaldo > Signed-off-by: Jiri Olsa > --- > tools/perf/Documentation/perf-daemon.txt | 8 ++++++++ > tools/perf/builtin-daemon.c | 10 ++++++++++ > 2 files changed, 18 insertions(+) > > diff --git a/tools/perf/Documentation/perf-daemon.txt b/tools/perf/Documentation/perf-daemon.txt > index 203ec4bf704c..87de2c77e4c7 100644 > --- a/tools/perf/Documentation/perf-daemon.txt > +++ b/tools/perf/Documentation/perf-daemon.txt > @@ -35,6 +35,9 @@ OPTIONS > Send SIGUSR2 to specific session, if session is not specified, > send SIGUSR2 to all sessions. > > +--stop:: > + Stop daemon. > + > -v:: > --verbose:: > Be more verbose. > @@ -116,6 +119,11 @@ And check that the perf data dump was trigered: > [ perf record: Dump /opt/perfdata/2/perf.data.2020120715220385 ] > > > +Stop daemon: > + > + # perf daemon --stop > + perf daemon is exciting > + > SEE ALSO > -------- > linkperf:perf-record[1], linkperf:perf-config[1] > diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c > index c53d4ddc2b49..855fed2fe364 100644 > --- a/tools/perf/builtin-daemon.c > +++ b/tools/perf/builtin-daemon.c > @@ -451,6 +451,7 @@ enum cmd { > CMD_LIST = 0, > CMD_LIST_VERBOSE = 1, > CMD_SIGNAL = 2, > + CMD_STOP = 3, > CMD_MAX, > }; > > @@ -528,6 +529,10 @@ static int handle_server_socket(struct daemon *daemon, int sock_fd) > case CMD_SIGNAL: > ret = cmd_session_kill(daemon, out, fd); > break; > + case CMD_STOP: > + done = 1; > + pr_debug("perf daemon is exciting\n"); > + break; > default: > break; > } > @@ -811,6 +816,7 @@ int cmd_daemon(int argc, const char **argv) > { > bool foreground = false; > bool signal = false; > + bool stop = false; > const char *config = NULL; > const char *signal_str = NULL; > struct daemon daemon = { > @@ -821,6 +827,7 @@ int cmd_daemon(int argc, const char **argv) > OPT_INCR('v', "verbose", &verbose, "be more verbose"), > OPT_STRING(0, "config", &config, > "config file", "config file path"), > + OPT_BOOLEAN(0, "stop", &stop, "stop daemon"), > OPT_BOOLEAN('f', "foreground", &foreground, "stay on console"), > OPT_STRING_OPTARG_SET('s', "signal", &signal_str, &signal, > "signal", "send signal to session", "all"), > @@ -837,5 +844,8 @@ int cmd_daemon(int argc, const char **argv) > if (signal) > return send_cmd(&daemon, CMD_SIGNAL, signal_str); > > + if (stop) > + return send_cmd(&daemon, CMD_STOP, NULL); > + > return send_cmd(&daemon, verbose ? CMD_LIST_VERBOSE : CMD_LIST, NULL); > } > -- > 2.26.2 > -- - Arnaldo