Messages in this thread | | | Subject | Re: new syntax for perf event | From | Peter Zijlstra <> | Date | Thu, 05 Jan 2012 15:10:56 +0100 |
| |
On Wed, 2011-12-21 at 17:16 +0100, Jiri Olsa wrote: > grammar
yacc/bison notation it seems.. lemme get the rules for that.
> ------- > events: > event_mod ',' event_mod | event_mod
events = event_mod, {',' , event_mod};
would be the EBNF variant for allowing inf repetition, not sure how to express that, it seems to want a recursive rule which I'm not sure I see. The way I read your thing it only allows 1 or 2 events.
> > event_mod: > event | event ':' modifier
event_mod = event, [':' , modifier];
Would be the EBNF thing, and I think your rule does indeed match that.
> event: > event_symbol | > event_cache | > 'cpu' '/' event_cpu | > 'tracepoint' '/' event_tracepoint > 'breakpoint' '/' event_breakpoint
I think I'd like to see something like:
event = pmu, '/', event_config | event_symbol | event_cache;
pmu = ? ls /sys/bus/event_source/devices ?; (* maybe add some aliasses like you suggest *)
event_config = (event_predef | event_term), {',', event_term};
event_predef = ? special name -> raw mapping read from somewhere ?;
event_term = event_sym, '=', value;
event_sym = "config" | "config1" | "config2" | ? contents of /sys/bus/event_source/devices/$pmu/format ?;
value = integer | hexint;
> event_symbol: > cpu-cycles|cycles > stalled-cycles-frontend|idle-cycles-frontend > stalled-cycles-backend|idle-cycles-backend > instructions > cache-references > cache-misses > branch-instructions|branches > branch-misses > bus-cycles > cpu-clock > task-clock > page-faults|faults > minor-faults > major-faults > context-switches|cs > cpu-migrations|migrations > alignment-faults > emulation-faults > > event_cache: > cache_type > cache_type '-' cache_result_op > cache_type '-' cache_result_op '-' cache_result_op
I'd write that as:
event_cache = cache_type, '-', cache_mod, ['-', cache_xs];
cache_type = cache_l1d | cache_l1i | cache_llc | cache_dtlb | cache_itlb | cache_branch | cache_node;
cache_mod = cache_load | cache_store | cache_prefetch;
cache_xs = cache_accesses | cache_misses;
cache_l1d = "L1-dcache" | ... ;
etc..
> event_cpu: > 'raw' ',' event_cpu_def > 'hw' ',' event_cpu_def > 'cache' ',' event_cpu_def
I think these are superfluous and we could deduce them from the actual event_term's used. Something using "config" will be a raw event etc..
> > event_cpu_def: > event_cpu_ass ',' event_cpu_ass | > event_cpu_ass > > event_cpu_ass: > event_cpu_elem '=' value
Hehehe, you said 'ass', hehe.
> event_tracepoint: > system ':' tracepoint > > event_breakpoint: > addr ':' type
Right, something like that.
> > modifier: > [ukhp]{1,4}
I think you need at least 5, or you can write it like:
modifier = ['u'], ['k'], ['h'], [3*'p'];
Also, I think we grew a few more modifiers with some of the perf kvm guest muck.
| |