• Wang Nan's avatar
    perf stat: Bail out on unsupported event config modifiers · 1669e509
    Wang Nan authored
    'perf stat' accepts some config terms but doesn't apply them. For
    example:
    
      # perf stat -e 'instructions/no-inherit/' -e 'instructions/inherit/' bash
      # ls
      # exit
    
      Performance counter stats for 'bash':
    
             266258061      instructions/no-inherit/
             266258061      instructions/inherit/
    
           1.402183915 seconds time elapsed
    
    The result is confusing, because user may expect the first
    'instructions' event exclude the 'ls' command.
    
    This patch forbid most of these config terms for 'perf stat'.
    
    Result:
    
      # ./perf stat -e 'instructions/no-inherit/' -e 'instructions/inherit/' bash
      event syntax error: 'instructions/no-inherit/'
                           \___ 'no-inherit' is not usable in 'perf stat'
      ...
    
    We can add blocked config terms back when 'perf stat' really supports them.
    
    This patch also removes unavailable config term from error message:
    
      # ./perf stat -e 'instructions/badterm/' ls
      event syntax error: 'instructions/badterm/'
                                        \___ unknown term
    
      valid terms: config,config1,config2,name
    
      # ./perf stat -e 'cpu/badterm/' ls
      event syntax error: 'cpu/badterm/'
                               \___ unknown term
    
      valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name
    Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
    Cc: Cody P Schafer <dev@codyps.com>
    Cc: He Kuang <hekuang@huawei.com>
    Cc: Jeremie Galarneau <jeremie.galarneau@efficios.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kirill Smelkov <kirr@nexedi.com>
    Cc: Li Zefan <lizefan@huawei.com>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Zefan Li <lizefan@huawei.com>
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1455882283-79592-11-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    1669e509
parse-events.c 50.6 KB