• yuzhoujian's avatar
    perf stat: Add support to print counts for fixed times · db06a269
    yuzhoujian authored
    Introduce a new option to print counts for fixed number of times and
    update 'perf stat' documentation accordingly.
    
    Show below is the output of the new option for perf stat.
    
      $ perf stat -I 1000 --interval-count 2 -e cycles -a
      #           time             counts unit events
               1.002827089         93,884,870      cycles
               2.004231506         56,573,446      cycles
    
    We can just print the counts for several times with this newly
    introduced option. The usage of it is a little like 'vmstat', and it
    should be used together with "-I" option.
    
      $ vmstat -n 1 2
      procs ---------memory-------------- --swap- ----io-- -system-- ------cpu---
       r  b swpd   free   buff   cache    si   so  bi   bo  in   cs us sy id wa st
       0  0    0 78270544 547484 51732076  0   0   0   20    1    1  1  0 99  0 0
       0  0    0 78270512 547484 51732080  0   0   0   16  477 1555  0  0 100 0 0
    
    Changes since v3:
    - merge interval_count check and times check to one line.
    - fix the wrong indent in stat.h
    - use stat_config.times instead of 'times' in cmd_stat function.
    
    Changes since v2:
    - none.
    
    Changes since v1:
    - change the name of the new option "times-print" to "interval-count".
    - keep the new option interval specifically.
    Signed-off-by: default avataryuzhoujian <yuzhoujian@didichuxing.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Milian Wolff <milian.wolff@kdab.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/r/1517217923-8302-2-git-send-email-ufo19890607@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    db06a269
builtin-stat.c 72.2 KB