Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp41634ybj; Fri, 8 May 2020 06:08:49 -0700 (PDT) X-Google-Smtp-Source: APiQypKnwDgsXptAky2NXDO731+pT8Yru+gH1KgCdTEt2R1R8sDvv+Q+ONkJCPJU54+H5uZZUcjI X-Received: by 2002:a05:6402:1515:: with SMTP id f21mr2153312edw.370.1588943329173; Fri, 08 May 2020 06:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588943329; cv=none; d=google.com; s=arc-20160816; b=jOBA6dQLVuiF/1vfvPjWuYa8JPtJEMwJ4FKY+zURcgoLFJEcqi2ToXleGO9nqyVeVN CBBpV5id+DOiimUwScIVvsrRsQTifC2COS1+4iQDgygyv0hape+7VIu0rfcYLwg9xbSh CEDJ3i16Du8LFZGfq9rkhvpKYXxRmSTkqFJrBUGBSZB7ebUNbwDLifRQ/w0XGbaktj/s GyFTnxBiVx/daCwZT3RwsQBOqQqIPR/8n5qpKsDw4fk4W/xOe6oMCo75rDVIaX0csixw dhy7nu89dyYlsXsKtr7+3GNOnVumz7JlsNkn97qAPR3aikQ1oC7BTWJzYAE8NG2vHIZB GPmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=T2H3ZK/uf2auqwzKcTBElVVk+cONFVBFkbSZc3ANfHY=; b=uMvjysHm5E9MD5TtxCo3StETeXFDP1cGlMjW4BAqynhwYmKGOeX0AhjEJyMORrTBvv EehSbukthmQBrWKXULiD3HqdCQcIEIYZ6CQF+RmIQRlh/9W358y6YISLmkDoLgOBQVrR ycRz7M3k1j7NVggOcGPVHBmvtBpUM+IW1v44k74AELUtagdplsCA8uEQ6Ry9b6JUsyQ8 DLegkks4cbAMMmK8wOxT6kVNvxVGncprUhrHmxeLfMKicM1tDlaCvBuM314XzXVe+dF7 tzrefBUPDTh3r7QN6FRDZRYq5Kb19Q4Tp4N1O6ER5dLa13MSwT8yVp6DUx+P4IjJtjdH RmpA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si913077ejr.32.2020.05.08.06.08.24; Fri, 08 May 2020 06:08:49 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729670AbgEHNF6 (ORCPT + 99 others); Fri, 8 May 2020 09:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730526AbgEHNF3 (ORCPT ); Fri, 8 May 2020 09:05:29 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6278DC05BD43; Fri, 8 May 2020 06:05:29 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jX2gu-0007hX-LP; Fri, 08 May 2020 15:05:24 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 856661C0475; Fri, 8 May 2020 15:05:05 +0200 (CEST) Date: Fri, 08 May 2020 13:05:05 -0000 From: "tip-bot2 for Arnaldo Carvalho de Melo" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf parse-events: Add parse_events_option() variant that creates evlist Cc: Jiri Olsa , Adrian Hunter , Namhyung Kim , Song Liu , Arnaldo Carvalho de Melo , x86 , LKML In-Reply-To: <20200429131106.27974-5-acme@kernel.org> References: <20200429131106.27974-5-acme@kernel.org> MIME-Version: 1.0 Message-ID: <158894310549.8414.1190785508623717399.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: d0abbc3ce695437fe83446aef44b2f5ef65a80b9 Gitweb: https://git.kernel.org/tip/d0abbc3ce695437fe83446aef44b2f5ef65a80b9 Author: Arnaldo Carvalho de Melo AuthorDate: Mon, 27 Apr 2020 13:58:11 -03:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Tue, 05 May 2020 16:35:29 -03:00 perf parse-events: Add parse_events_option() variant that creates evlist For the upcoming --switch-output-event option we want to create the side band event, populate it with the specified events and then, if it is present multiple times, go on adding to it, then, if the BPF tracking is required, use the first event to set its attr.bpf_event to get those PERF_RECORD_BPF_EVENT metadata events too. Acked-by: Jiri Olsa Cc: Adrian Hunter Cc: Namhyung Kim Cc: Song Liu Link: http://lore.kernel.org/lkml/20200429131106.27974-5-acme@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/parse-events.c | 23 +++++++++++++++++++++++ tools/perf/util/parse-events.h | 1 + 2 files changed, 24 insertions(+) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 1010774..5795f3a 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -2190,6 +2190,29 @@ int parse_events_option(const struct option *opt, const char *str, return ret; } +int parse_events_option_new_evlist(const struct option *opt, const char *str, int unset) +{ + struct evlist **evlistp = opt->value; + int ret; + + if (*evlistp == NULL) { + *evlistp = evlist__new(); + + if (*evlistp == NULL) { + fprintf(stderr, "Not enough memory to create evlist\n"); + return -1; + } + } + + ret = parse_events_option(opt, str, unset); + if (ret) { + evlist__delete(*evlistp); + *evlistp = NULL; + } + + return ret; +} + static int foreach_evsel_in_last_glob(struct evlist *evlist, int (*func)(struct evsel *evsel, diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 27596cb..6ead966 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -31,6 +31,7 @@ bool have_tracepoints(struct list_head *evlist); const char *event_type(int type); int parse_events_option(const struct option *opt, const char *str, int unset); +int parse_events_option_new_evlist(const struct option *opt, const char *str, int unset); int parse_events(struct evlist *evlist, const char *str, struct parse_events_error *error); int parse_events_terms(struct list_head *terms, const char *str);