• Ian Rogers's avatar
    perf parse-events: Improve error message for bad numbers · ba5c371e
    Ian Rogers authored
    Use the error handler from the parse_state to give a more informative
    error message.
    
    Before:
    
      $ perf stat -e 'cycles/period=99999999999999999999/' true
      event syntax error: 'cycles/period=99999999999999999999/'
                                        \___ parser error
      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 'cycles/period=99999999999999999999/' true
      event syntax error: 'cycles/period=99999999999999999999/'
                                        \___ parser error
    
      event syntax error: '..les/period=99999999999999999999/'
                                        \___ Bad base 10 number "99999999999999999999"
      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 avatarKan Liang <kan.liang@linux.intel.com>
    Tested-by: default avatarAtish Patra <atishp@rivosinc.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Beeman Strong <beeman@rivosinc.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: James Clark <james.clark@arm.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20240416061533.921723-12-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    ba5c371e
parse-events.l 12 KB