• Ian Rogers's avatar
    perf parse-events: Print all errors · fd7b8e8f
    Ian Rogers authored
    Prior to this patch the first and the last error encountered during
    parsing are printed. To see other errors verbose needs
    enabling. Unfortunately this can drop useful errors, in particular on
    terms. This patch changes the errors so that instead of the first and
    last all errors are recorded and printed, the underlying data
    structure is changed to a list.
    
    Before:
    ```
    $ perf stat -e 'slots/edge=2/' true
    event syntax error: 'slots/edge=2/'
                                    \___ Bad event or PMU
    
    Unable to find PMU or event on a PMU of 'slots'
    
    Initial error:
    event syntax error: 'slots/edge=2/'
                         \___ Cannot find PMU `slots'. Missing kernel support?
    Run 'perf list' for a list of valid events
    
     Usage: perf stat [<options>] [<command>]
    
        -e, --event <event>   event selector. use 'perf list' to list available events
    ```
    
    After:
    ```
    $ perf stat -e 'slots/edge=2/' true
    event syntax error: 'slots/edge=2/'
                         \___ Bad event or PMU
    
    Unable to find PMU or event on a PMU of 'slots'
    
    event syntax error: 'slots/edge=2/'
                                    \___ value too big for format (edge), maximum is 1
    
    event syntax error: 'slots/edge=2/'
                         \___ Cannot find PMU `slots'. Missing kernel support?
    Run 'perf list' for a list of valid events
    
     Usage: perf stat [<options>] [<command>]
    
        -e, --event <event>   event selector. use 'perf list' to list available events
    ```
    Signed-off-by: default avatarIan Rogers <irogers@google.com>
    Reviewed-by: default avatarJames Clark <james.clark@arm.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: tchen168@asu.edu
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Link: https://lore.kernel.org/r/20240131134940.593788-3-irogers@google.com
    fd7b8e8f
parse-events.y 15.7 KB