original_kernel/tools/perf/util
Paul Mackerras 61c45981dd perf_counter tools: Rework event string parsing/syntax
This reworks the parser for event descriptors to make it more
consistent in what it accepts.  It is now structured as a
recursive descent parser for the following grammar:

events		::= event ( ("," | space) space* event )*
event		::= ( raw_event | numeric_event | symbolic_event |
		      generic_hw_event ) [ event_modifier ]
raw_event	::= "r" hex_number
numeric_event	::= number ":" number
number		::= decimal_number | "0x" hex_number | "0" octal_number
symbolic_event	::= string_from_event_symbols_array
generic_hw_event::= cache_type ( "-" ( cache_op | cache_result ) )*
event_modifier	::= ":" ( "u" | "k" | "h" )+

with the extra restriction that you can have at most one
cache_op and at most one cache_result.

We pass the current string pointer by reference (i.e. as a
const char **) to the various parsing functions so that they
can advance the pointer to indicate how much they consumed.
They return 0 if they didn't recognize the thing at the pointer
or 1 if they did (and advance the pointer past it).

This also fixes parse_aliases to take the longest matching
alias from the table, not the first one.  Otherwise "l1-data"
would match the "l1-d" alias and the "ata" would not be
consumed.

This allows event modifiers indicating what processor modes to
count in to be applied to any event, not just numeric events,
and adds a ":h" modifier to indicate counting in hypervisor
mode.  Specifying ":u" now sets both exclude_kernel and
exclude_hv, and so on.  Multiple modes can be specified, e.g.
":uk" will count in user or hypervisor mode (i.e. only
exclude_kernel will be set).

Signed-off-by: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <19018.53826.843815.189847@cargo.ozlabs.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-07-01 10:23:17 +02:00
..
PERF-VERSION-GEN
abspath.c
alias.c perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
cache.h
callchain.c perf_counter tools: Various fixes for callchains 2009-07-01 09:58:52 +02:00
callchain.h perf_counter tools: Resolve symbols in callchains 2009-07-01 09:58:26 +02:00
color.c
color.h
config.c
ctype.c
environment.c
exec_cmd.c
exec_cmd.h
generate-cmdlist.sh
header.c
header.h
help.c perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
help.h
levenshtein.c
levenshtein.h
list.h
pager.c perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
parse-events.c perf_counter tools: Rework event string parsing/syntax 2009-07-01 10:23:17 +02:00
parse-events.h
parse-options.c
parse-options.h
path.c
quote.c
quote.h
rbtree.c
rbtree.h
run-command.c perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
run-command.h perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
sigchain.c
sigchain.h
strbuf.c
strbuf.h
string.c
string.h
strlist.c perf report: Add --dsos parameter 2009-07-01 00:07:09 +02:00
strlist.h perf report: Add --dsos parameter 2009-07-01 00:07:09 +02:00
symbol.c perf_counter tools: Adjust only prelinked symbol's addresses 2009-06-30 17:09:30 +02:00
symbol.h perf_counter tools: Adjust only prelinked symbol's addresses 2009-06-30 17:09:30 +02:00
types.h
usage.c
util.h perf_counter tools: Remove dead code 2009-06-27 06:06:39 +02:00
wrapper.c