Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752892Ab1CYNfW (ORCPT ); Fri, 25 Mar 2011 09:35:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:63282 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751173Ab1CYNfV (ORCPT ); Fri, 25 Mar 2011 09:35:21 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.63,242,1299484800"; d="scan'208";a="725078465" Subject: Re: [RFC] perf: EBNF for event syntax From: Lin Ming To: Peter Zijlstra Cc: "mingo@elte.hu" , Arnaldo Carvalho de Melo , Masami Hiramatsu , Frederic Weisbecker , LKML , Paul Mackerras , Stephane Eranian , Steven Rostedt , Thomas Gleixner , Hitoshi Mitake , Corey Ashford , Matt Fleming In-Reply-To: <1301051277.2250.195.camel@laptop> References: <1300851416.31224.58.camel@minggr.sh.intel.com> <1301051277.2250.195.camel@laptop> Content-Type: text/plain; charset="UTF-8" Date: Fri, 25 Mar 2011 21:35:21 +0800 Message-Id: <1301060121.2269.1.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.0 (2.28.0-2.fc12) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2933 Lines: 82 On Fri, 2011-03-25 at 19:07 +0800, Peter Zijlstra wrote: > On Wed, 2011-03-23 at 11:36 +0800, Lin Ming wrote: > > Hi, all > > > > On Thu, Mar 17, 2011 at 2:02 AM, Peter Zijlstra wrote: > > > How about we start writing proper EBNF syntax rules for this stuff, its > > > getting seriously out of hand. > > http://marc.info/?l=linux-kernel&m=130029871318866&w=2 > > > > As Peter suggested, I wrote a simple EBNF for event syntax, as below. > > My first plan is to pass in extra config value for some events, > > for example, offcore response and load latency. > > > > perf record -e r100b(0004):p > > > > As above, the extra config value 0004 is passed in the parentheses. > > > > The EBNF > > ======== > > > > EventList := Event [',' EventList] > > There was a suggestion a while back to make: > > -e ev1,ev2,ev3 > > create an event group with ev2 and ev3 siblings of ev1, and have > multiple -e instances create separate counters. > > The problem is that its not backwards compatible, but something like > that would still be very nice to have. Currently, it means a list of independent events, right? > > > Event := HardwareEvent | > > RawEvent | > > SoftwareEvent | > > TracepointEvent | > > HardwareBreakpointEvent > > > > HardwareEvent := HardwareEventName [ExtraConfig] [Modifer] > > HardwareEventName := 'cpu-cycles' | 'cycles' | 'instructions' /* and so on ...*/ > > ExtraConfig := '(' ConfigValue [',' ConfigValue] ')' > > ConfigValue := HexNumber > > > > RawEvent := RawSeperator RawCode [ExtraConfig] [Modifer] > > RawSeperator := 'r' > > RawCode := HexNumber > > > > SoftwareEvent := SoftwareEventName > > SoftwareEventName := 'cpu-clock' | 'task-clock' | 'faults' /* and so on ...*/ > > > > TracepointEvent := SubsystemName ':' TracepointName > > SubsystemName := /* All AsciiString except the pre-defined hardware/software/cache events name and BreakpointSeparator */ > > TracepointName := '*' | AsciiString > > > > HardwareBreakpointEvent := BreakpointSeparator BreakpointAddress [':' AccessType] > > BreakpointSeparator := 'mem:' > > BreakpointAddress := HexNumber > > AccessType := 'r' | 'w' | 'x' > > > > Modifier := ModifierSperator ModifierList > > ModifierSperator := ':' > > ModifierList := ModifierItem ModifierList > > ModifierItem := {PreciseModifer} | kernelModifer | UserModifer | HypervisorModifer > > PreciseModifer := 'p' /* Can be multiple PreciseModifers */ > > kernelModifer := 'k' > > UserModifer := 'u' > > HypervisorModifer := 'h' > > Otherwise, very nice. Eventually we'll be able to use a parser generator > for this. Yes, bison/yacc is good for this. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/