• W
    perf tools: Enhance the matching of sub-commands abbreviations · ae0f4eb3
    Wei Li 提交于
    We support short command 'rec*' for 'record' and 'rep*' for 'report' in
    lots of sub-commands, but the matching is not quite strict currnetly.
    
    It may be puzzling sometime, like we mis-type a 'recport' to report but
    it will perform 'record' in fact without any message.
    
    To fix this, add a check to ensure that the short cmd is valid prefix
    of the real command.
    
    Committer testing:
    
      [root@quaco ~]# perf c2c re sleep 1
    
       Usage: perf c2c {record|report}
    
          -v, --verbose         be more verbose (show counter open errors, etc)
    
      # perf c2c rec sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ]
      # perf c2c recport sleep 1
    
       Usage: perf c2c {record|report}
    
          -v, --verbose         be more verbose (show counter open errors, etc)
    
      # perf c2c record sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ]
      # perf c2c records sleep 1
    
       Usage: perf c2c {record|report}
    
          -v, --verbose         be more verbose (show counter open errors, etc)
    
      #
    Signed-off-by: NWei Li <liwei391@huawei.com>
    Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Hanjun Guo <guohanjun@huawei.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Rui Xiang <rui.xiang@huawei.com>
    Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    ae0f4eb3
builtin-stat.c 70.0 KB