Received: by 10.223.185.116 with SMTP id b49csp744314wrg; Sat, 3 Mar 2018 06:35:32 -0800 (PST) X-Google-Smtp-Source: AG47ELvwjDT0o/m8p0J+7hbvcW6msER6zww2UCm3OshRVBy2aVlIrDFv0Ue2/7yZ6zspZfgZfULs X-Received: by 10.99.5.197 with SMTP id 188mr7414356pgf.196.1520087732144; Sat, 03 Mar 2018 06:35:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520087732; cv=none; d=google.com; s=arc-20160816; b=MYXFV16ATigX/2d+HnWwCjBdvZf3dCnakL0CsbyLknxXS5+idcAF9s5p5YgSV4OJf3 kG2fqpSYQfJv75D7MDiM6y3quOS+5UQXIS7xhZX0JWG1HRUfN0NfvnwD9DdJjzmbvWWe 0RvSk7tAGDcEYP74w4SuA+6yJPIZxhdTpIUn3Hn5raglvF5yfnxLvfGfbbXowiwNC7Iq ColrT0t0vJOMgozJG/dT6sbOvKpbcxN01YhBnzAr4OECn7eDTzqbdg8+sU+WgaXNAEMo gBQk+t4njPDmSq0W6PWMrZ3zWUPH3NlgNnTgquHCW0+StG5892VIuFYe/mC13hP93ABr Z53A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=9xHzF1gmAVh8zZdTTgOwCt9xdl+sol8RyGhcAT39vV4=; b=kws1qs3bltdeUuNxBUmqJsf1MjsJjGnCsJBsNDkCG2GbzA9yT8DzcTZ0uMdSsKXSXp 3MXUdMCNWo+AUazzVzPYDeAUXI+XwOCLuqu2h7HIZsd/HvRSnygQTlehyglOmzAYXikK 0lpUu5ZndfBTZ5C2uMgghxogHo98uySxFzUPlmoqPYZW5c7ruVd2s/2DBrlyA7kZlULu a+HRjiAVfgUKmsr64dWt3kQOvq6kpV69i6MlKnY3JNxAzZq3+4xafP8jZrK94CKQuMXO aLyPmopl07ED07UYqpyLudrYkjCGw/VK4uXeAko+L/uofOZXT0VsQP8And+mcgpbiZL3 c8Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k194si5575672pgc.662.2018.03.03.06.35.17; Sat, 03 Mar 2018 06:35:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027AbeCCOek (ORCPT + 99 others); Sat, 3 Mar 2018 09:34:40 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56062 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751863AbeCCOej (ORCPT ); Sat, 3 Mar 2018 09:34:39 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A975040201A1; Sat, 3 Mar 2018 14:34:38 +0000 (UTC) Received: from krava (unknown [10.43.17.11]) by smtp.corp.redhat.com (Postfix) with SMTP id C2FB42024CAD; Sat, 3 Mar 2018 14:34:36 +0000 (UTC) Date: Sat, 3 Mar 2018 15:34:36 +0100 From: Jiri Olsa To: Agustin Vega-Frias Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Andi Kleen , Alexander Shishkin , Namhyung Kim , timur@codeaurora.org Subject: Re: [RFC V2 1/3] perf, tools: Support wildcards on pmu name in dynamic pmu events Message-ID: <20180303143436.GA14563@krava> References: <1520034092-35275-1-git-send-email-agustinv@codeaurora.org> <1520034092-35275-2-git-send-email-agustinv@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520034092-35275-2-git-send-email-agustinv@codeaurora.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 03 Mar 2018 14:34:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Sat, 03 Mar 2018 14:34:38 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 02, 2018 at 06:41:30PM -0500, Agustin Vega-Frias wrote: SNIP > > diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l > index 655ecff..a1a01b1 100644 > --- a/tools/perf/util/parse-events.l > +++ b/tools/perf/util/parse-events.l > @@ -175,7 +175,7 @@ bpf_source [^,{}]+\.c[a-zA-Z0-9._]* > num_dec [0-9]+ > num_hex 0x[a-fA-F0-9]+ > num_raw_hex [a-fA-F0-9]+ > -name [a-zA-Z_*?][a-zA-Z0-9_*?.]* > +name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]]* > name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* > drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? > /* If you add a modifier you need to update check_modifier() */ > diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y > index e81a20e..c528469 100644 > --- a/tools/perf/util/parse-events.y > +++ b/tools/perf/util/parse-events.y > @@ -8,6 +8,7 @@ > > #define YYDEBUG 1 > > +#include > #include > #include > #include > @@ -241,7 +242,7 @@ PE_NAME opt_event_config > if (!strncmp(name, "uncore_", 7) && > strncmp($1, "uncore_", 7)) > name += 7; > - if (!strncmp($1, name, strlen($1))) { > + if (!strncmp($1, name, strlen($1)) || !fnmatch($1, name, 0)) { could we now get rid of the strncmp in here and keep the glob matching only? I find it confusing now that following commands give me same results: - [root@krava perf]# ./perf stat -e 'cbox/clockticks/' --no-merge -a sleep 1 Performance counter stats for 'system wide': uncore_cbox_1/clockticks/ 281,474,957,674,239 uncore_cbox_0/clockticks/ 1.000958335 seconds time elapsed - [root@krava perf]# ./perf stat -e '*cbox*/clockticks/' --no-merge -a sleep 1 Performance counter stats for 'system wide': uncore_cbox_1/clockticks/ 5,427,337 uncore_cbox_0/clockticks/ 1.000962724 seconds time elapsed - [root@krava perf]# ./perf stat -e 'cbox*/clockticks/' --no-merge -a sleep 1 Performance counter stats for 'system wide': uncore_cbox_1/clockticks/ 281,474,969,621,374 uncore_cbox_0/clockticks/ 1.001026179 seconds time elapsed and this one fails: - [root@krava perf]# ./perf stat -e '*cbox/clockticks/' --no-merge -a sleep 1 event syntax error: '*cbox/clockticks/' \___ Cannot find PMU `*cbox'. Missing kernel support? Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list available events despite the fact that it makes as much sense as the previous one: perf stat -e 'cbox*/clockticks/' I'd think let's keep just the glob matching, so it's clear you what you use wildcards for.. thoughts? thanks, jirka