From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2C7EC433E0 for ; Tue, 2 Jun 2020 11:51:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A3CD206E2 for ; Tue, 2 Jun 2020 11:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591098713; bh=A2LxwpMi7iRY+ycM3jJ233LyV/tFq4cRqVEdy9A9nAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sKwW5YqRo/Oe4yWaCO0vnBDoXd7UMEEygrs4Zkix1y8b5eF3xzJi7FTT8F2DcSANH S2dSrVJlp2wZQS5jvwqx3fG5Wb841clZRxWF5zYxk9jlJxhmDM3qHheKaD0micmBK7 7xhBOks8G4vPbnDmf1fLwDDoeoU1ba1ghKLC9O3s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728091AbgFBLv0 convert rfc822-to-8bit (ORCPT ); Tue, 2 Jun 2020 07:51:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22258 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727863AbgFBLvY (ORCPT ); Tue, 2 Jun 2020 07:51:24 -0400 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-27-HgSuWPNbPmOd7xNLz4q4_A-1; Tue, 02 Jun 2020 07:51:14 -0400 X-MC-Unique: HgSuWPNbPmOd7xNLz4q4_A-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B63D2107ACF4; Tue, 2 Jun 2020 11:51:12 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B1F610013D7; Tue, 2 Jun 2020 11:51:10 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ian Rogers , Stephane Eranian , Andi Kleen Subject: [PATCH 05/13] perf tools: Factor out parse_groups function Date: Tue, 2 Jun 2020 13:50:47 +0200 Message-Id: <20200602115055.1168446-6-jolsa@kernel.org> In-Reply-To: <20200602115055.1168446-1-jolsa@kernel.org> References: <20200602115055.1168446-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Factor out the parse_groups function, it will be used for new test interface coming in following changes. Signed-off-by: Jiri Olsa --- tools/perf/util/metricgroup.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 9a90afb4428c..47afe5867f9b 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -709,14 +709,12 @@ static void metricgroup__free_egroups(struct list_head *group_list) } } -int metricgroup__parse_groups(const struct option *opt, - const char *str, - bool metric_no_group, - bool metric_no_merge, - struct rblist *metric_events) +static int parse_groups(struct evlist *perf_evlist, const char *str, + bool metric_no_group, + bool metric_no_merge, + struct rblist *metric_events) { struct parse_events_error parse_error; - struct evlist *perf_evlist = *(struct evlist **)opt->value; struct strbuf extra_events; LIST_HEAD(group_list); int ret; @@ -742,6 +740,18 @@ int metricgroup__parse_groups(const struct option *opt, return ret; } +int metricgroup__parse_groups(const struct option *opt, + const char *str, + bool metric_no_group, + bool metric_no_merge, + struct rblist *metric_events) +{ + struct evlist *perf_evlist = *(struct evlist **)opt->value; + + return parse_groups(perf_evlist, str, metric_no_group, + metric_no_merge, metric_events); +} + bool metricgroup__has_metric(const char *metric) { struct pmu_events_map *map = perf_pmu__find_map(NULL); -- 2.25.4