• Jiri Olsa's avatar
    perf stat record: Write stat events on record · 5a6ea81b
    Jiri Olsa authored
    Writing stat events on 'perf stat record' at the time we read counter
    values from kernel.
    
    Committer note:
    
    After the patch:
    
      $ perf stat record usleep 1
    
       Performance counter stats for 'usleep 1':
    
              0.598006      task-clock (msec)         #    0.484 CPUs utilized
                     1      context-switches          #    0.002 M/sec
                     0      cpu-migrations            #    0.000 K/sec
                    52      page-faults               #    0.087 M/sec
               882,744      cycles                    #    1.476 GHz
               581,416      stalled-cycles-frontend   #   65.86% frontend cycles idle
       <not supported>      stalled-cycles-backend
               636,479      instructions              #    0.72  insns per cycle
                                                      #    0.91  stalled cycles per insn
               129,334      branches                  #  216.275 M/sec
                 7,512      branch-misses             #    5.81% of all branches
    
           0.001235157 seconds time elapsed
    
      $ oldperf evlist
      task-clock
      context-switches
      cpu-migrations
      page-faults
      cycles
      stalled-cycles-frontend
      stalled-cycles-backend
      instructions
      branches
      branch-misses
      $ oldperf report --stdio
      Error:
      The perf.data file has no samples!
      # To display the perf.data header info, please use --header/--header-only options.
      #
      $ perf report -D | grep PERF_RECORD
      0x5b0 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 5504
      0x5d8 [0x12]: PERF_RECORD_CPU_MAP nr: 1 cpu: 65535
      0x5ea [0x40]: PERF_RECORD_STAT_CONFIG
      0x62a [0x30]: PERF_RECORD_STAT
      0x65a [0x30]: PERF_RECORD_STAT
      0x68a [0x30]: PERF_RECORD_STAT
      0x6ba [0x30]: PERF_RECORD_STAT
      0x6ea [0x30]: PERF_RECORD_STAT
      0x71a [0x30]: PERF_RECORD_STAT
      0x74a [0x30]: PERF_RECORD_STAT
      0x77a [0x30]: PERF_RECORD_STAT
      0x7aa [0x30]: PERF_RECORD_STAT
      -1 -1 0x7da [0x40]: PERF_RECORD_MMAP -1/0: [0xffffffff81000000(0x1f000000) @ 0xffffffff81000000]: x [kernel.kallsyms]_text
      $
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarKan Liang <kan.liang@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1446734469-11352-8-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    5a6ea81b
builtin-stat.c 42.2 KB