Star64_linux/tools/perf/util
Jin Yao 8358f698ec perf stat: Fix no metric header if --per-socket and --metric-only set
We received a report that was no metric header displayed if --per-socket
and --metric-only were both set.

It's hard for script to parse the perf-stat output. This patch fixes this
issue.

Before:

  root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
  ^C
   Performance counter stats for 'system wide':

  S0        8                  2.6

         2.215270071 seconds time elapsed

  root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
  #           time socket cpus
       1.000411692 S0        8                  2.2
       2.001547952 S0        8                  3.4
       3.002446511 S0        8                  3.4
       4.003346157 S0        8                  4.0
       5.004245736 S0        8                  0.3

After:

  root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
  ^C
   Performance counter stats for 'system wide':

                               CPI
  S0        8                  2.1

         1.813579830 seconds time elapsed

  root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
  #           time socket cpus                  CPI
       1.000415122 S0        8                  3.2
       2.001630051 S0        8                  2.9
       3.002612278 S0        8                  4.3
       4.003523594 S0        8                  3.0
       5.004504256 S0        8                  3.7

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200331180226.25915-1-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-04-14 08:49:26 -03:00
..
c++ perf clang: Fix build with Clang 9 2020-01-14 12:02:19 -03:00
cs-etm-decoder
include perf bench: Update the copies of x86's mem{cpy,set}_64.S 2019-12-02 11:40:57 -03:00
intel-pt-decoder
libunwind
scripting-engines perf script report: Fix SEGFAULT when using DWARF mode 2020-04-03 09:39:53 -03:00
affinity.c perf affinity: Add infrastructure to save/restore affinity 2019-11-28 08:08:38 -03:00
affinity.h perf affinity: Add infrastructure to save/restore affinity 2019-11-28 08:08:38 -03:00
annotate.c perf annotate: Get rid of annotation->nr_jumps 2020-03-04 10:34:10 -03:00
annotate.h perf report: Support interactive annotation of code without symbols 2020-03-24 09:36:33 -03:00
archinsn.h
arm-spe-pkt-decoder.c
arm-spe-pkt-decoder.h
arm-spe.c
arm-spe.h
auxtrace.c perf auxtrace: Add auxtrace_record__read_finish() 2020-02-18 10:13:29 -03:00
auxtrace.h perf auxtrace: Add auxtrace_record__read_finish() 2020-02-18 10:13:29 -03:00
block-info.c perf block-info: Support color ops to print block percents in color 2020-03-09 21:43:25 -03:00
block-info.h perf block-info: Allow selecting which columns to report and its order 2020-03-09 21:43:25 -03:00
block-range.c
block-range.h
bpf-event.c perf maps: Merge 'struct maps' with 'struct map_groups' 2019-11-26 11:07:46 -03:00
bpf-event.h
bpf-loader.c
bpf-loader.h
bpf-prologue.c
bpf-prologue.h
bpf_map.c
bpf_map.h
branch.c
branch.h perf tools: Add hw_idx in struct branch_stack 2020-03-09 21:42:53 -03:00
Build perf expr: Move expr lexer to flex 2020-03-09 21:43:24 -03:00
build-id.c
build-id.h
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c perf map_symbol: Rename ms->mg to ms->maps 2019-11-26 11:07:46 -03:00
callchain.h perf callchain: Use 'struct map_symbol' in 'struct callchain_cursor_node' 2019-11-12 08:20:53 -03:00
cap.c
cap.h
cgroup.c perf cgroup: Maintain cgroup hierarchy 2020-04-03 09:37:55 -03:00
cgroup.h perf cgroup: Maintain cgroup hierarchy 2020-04-03 09:37:55 -03:00
cloexec.c
cloexec.h
color.c
color.h
color_config.c
comm.c
comm.h
compress.h
config.c perf config: Introduce perf_config_u8() 2020-02-27 10:44:54 -03:00
config.h perf config: Introduce perf_config_u8() 2020-02-27 10:44:54 -03:00
copyfile.c
copyfile.h
counts.c
counts.h
cpu-set-sched.h
cpumap.c perf cpumap: Fix snprintf overflow check 2020-03-24 10:36:00 -03:00
cpumap.h perf evsel: Add iterator to iterate over events ordered by CPU 2019-11-29 12:20:45 -03:00
cputopo.c
cputopo.h
cs-etm.c perf cs-etm: Fix unsigned variable comparison to zero 2020-03-11 10:48:44 -03:00
cs-etm.h
data-convert-bt.c
data-convert-bt.h
data-convert.h
data.c
data.h
db-export.c perf addr_location: Rename al->mg to al->maps 2019-11-26 11:07:46 -03:00
db-export.h
debug.c perf tool: Provide an option to print perf_event_open args and return value 2019-11-12 08:32:27 -03:00
debug.h perf tool: Provide an option to print perf_event_open args and return value 2019-11-12 08:32:27 -03:00
demangle-java.c
demangle-java.h
demangle-rust.c
demangle-rust.h
dso.c perf dso: Move dso_id from 'struct map' to 'struct dso' 2019-11-19 19:12:26 -03:00
dso.h perf dso: Move dso_id from 'struct map' to 'struct dso' 2019-11-19 19:12:26 -03:00
dsos.c perf dso: Fix dso comparison 2020-03-24 10:57:38 -03:00
dsos.h perf dso: Move dso_id from 'struct map' to 'struct dso' 2019-11-19 19:12:26 -03:00
dump-insn.c
dump-insn.h
dwarf-aux.c perf probe: Show correct statement line number by perf probe -l 2019-11-18 18:56:27 -03:00
dwarf-aux.h
dwarf-regs.c
env.c perf cgroup: Maintain cgroup hierarchy 2020-04-03 09:37:55 -03:00
env.h perf cgroup: Maintain cgroup hierarchy 2020-04-03 09:37:55 -03:00
event.c perf script: Allow --symbol to accept hexadecimal addresses 2020-04-03 09:37:56 -03:00
event.h perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
events_stats.h
evlist.c perf stat: Use affinity for enabling/disabling events 2019-11-29 12:20:45 -03:00
evlist.h perf stat: Use affinity for opening events 2019-11-29 12:20:45 -03:00
evsel.c perf record: Add --all-cgroups option 2020-04-03 09:37:55 -03:00
evsel.h perf record: Add --all-cgroups option 2020-04-03 09:37:55 -03:00
evsel_config.h perf parse: Copy string to perf_evsel_config_term 2020-01-30 11:55:02 +01:00
evsel_fprintf.c perf callchain: Use 'struct map_symbol' in 'struct callchain_cursor_node' 2019-11-12 08:20:53 -03:00
evsel_fprintf.h
evswitch.c
evswitch.h
expr.c perf expr: Make expr__parse() return -1 on error 2020-03-09 21:43:25 -03:00
expr.h perf expr: Straighten expr__parse()/expr__find_other() interface 2020-03-09 21:43:24 -03:00
expr.l perf expr: Fix copy/paste mistake 2020-03-17 18:01:40 -03:00
expr.y perf expr: Move expr lexer to flex 2020-03-09 21:43:24 -03:00
find-map.c
fncache.c perf pmu: Use file system cache to optimize sysfs access 2019-11-28 08:08:38 -03:00
fncache.h perf pmu: Use file system cache to optimize sysfs access 2019-11-28 08:08:38 -03:00
genelf.c perf jit: Move test functionality in to a test 2019-11-29 12:20:45 -03:00
genelf.h
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c
get_current_dir_name.h
group.h
header.c perf header: Add check for unexpected use of reserved membrs in event attr 2020-03-09 21:43:24 -03:00
header.h
help-unknown-cmd.c
help-unknown-cmd.h
hist.c perf report: Add 'cgroup' sort key 2020-04-03 09:37:55 -03:00
hist.h perf report: Add 'cgroup' sort key 2020-04-03 09:37:55 -03:00
intel-bts.c
intel-bts.h
intel-pt.c perf tools: Add hw_idx in struct branch_stack 2020-03-09 21:42:53 -03:00
intel-pt.h
intlist.c
intlist.h
jit.h
jitdump.c
jitdump.h
kvm-stat.h
levenshtein.c
levenshtein.h
llvm-utils.c perf llvm: Add debug hint message about missing kernel-devel package 2020-03-04 10:34:10 -03:00
llvm-utils.h
lzma.c
machine.c perf cgroup: Maintain cgroup hierarchy 2020-04-03 09:37:55 -03:00
machine.h perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
map.c perf map: Use strstarts() to look for Android libraries 2020-03-11 10:48:44 -03:00
map.h perf maps: Merge 'struct maps' with 'struct map_groups' 2019-11-26 11:07:46 -03:00
map_symbol.h perf map_symbol: Rename ms->mg to ms->maps 2019-11-26 11:07:46 -03:00
maps.h perf maps: Rename map_groups.h to maps.h 2019-11-26 11:07:46 -03:00
mem-events.c pref tools: Make 'struct addr_map_symbol' contain 'struct map_symbol' 2019-11-12 08:20:53 -03:00
mem-events.h
mem2node.c
mem2node.h
memswap.c
memswap.h
metricgroup.c perf metricgroup: Fix printing event names of metric group with multiple events incase of overlapping events 2020-03-24 09:37:27 -03:00
metricgroup.h
mmap.c perf record: Fix binding of AIO user space buffers to nodes 2020-03-12 11:32:46 -03:00
mmap.h perf record: Adapt affinity to machines with #CPUs > 1K 2020-01-06 11:46:09 -03:00
namespaces.c
namespaces.h
ordered-events.c
ordered-events.h
parse-branch-options.c
parse-branch-options.h
parse-events.c perf parse-events: Fix 3 use after frees found with clang ASAN 2020-03-23 11:08:29 -03:00
parse-events.h perf record: Add aux-sample-size config term 2019-11-22 10:48:13 -03:00
parse-events.l perf events parser: Add missing Intel CPU events to parser 2020-04-03 09:37:56 -03:00
parse-events.y perf tools: Use %define api.pure full instead of %pure-parser 2020-01-14 12:02:19 -03:00
parse-regs-options.c
parse-regs-options.h
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
PERF-VERSION-GEN
perf_event_attr_fprintf.c perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
perf_regs.c
perf_regs.h perf regs: Make perf_reg_name() return "unknown" instead of NULL 2019-11-28 08:08:38 -03:00
pmu.c perf parse-events: Add defensive NULL check 2020-03-26 11:03:53 -03:00
pmu.h perf pmu: Make pmu_uncore_alias_match() public 2020-03-24 10:35:59 -03:00
pmu.l
pmu.y
print_binary.c
print_binary.h
probe-event.c perf maps: Rename map_groups.h to maps.h 2019-11-26 11:07:46 -03:00
probe-event.h perf probe: Trace a magic number if variable is not found 2019-11-18 19:09:23 -03:00
probe-file.c perf probe: Fix to delete multiple probe event 2020-03-09 10:41:14 -03:00
probe-file.h perf probe: Support DW_AT_const_value constant value 2019-11-18 19:08:02 -03:00
probe-finder.c perf probe: Do not depend on dwfl_module_addrsym() 2020-03-09 10:43:53 -03:00
probe-finder.h perf probe: Trace a magic number if variable is not found 2019-11-18 19:09:23 -03:00
pstack.c
pstack.h
python-ext-sources perf python: Include rwsem.c in the pythong biding 2020-04-03 09:37:55 -03:00
python.c perf tool: Provide an option to print perf_event_open args and return value 2019-11-12 08:32:27 -03:00
rb_resort.h
rblist.c
rblist.h
record.c perf record: Add a function to test for kernel support for AUX area sampling 2019-11-22 10:43:24 -03:00
record.h perf record: Add --all-cgroups option 2020-04-03 09:37:55 -03:00
rlimit.c
rlimit.h
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c
sample-raw.h
session.c perf tools: Basic support for CGROUP event 2020-04-03 09:37:55 -03:00
session.h perf session: Add facility to peek at all events 2019-11-22 10:48:13 -03:00
setns.c
setup.py perf python: Check if clang supports -fno-semantic-interposition 2020-04-14 08:43:18 -03:00
smt.c
smt.h
sort.c perf report: Add 'cgroup' sort key 2020-04-03 09:37:55 -03:00
sort.h perf report: Add 'cgroup' sort key 2020-04-03 09:37:55 -03:00
spark.c
spark.h
srccode.c perf pmu: Use file system cache to optimize sysfs access 2019-11-28 08:08:38 -03:00
srccode.h
srcline.c perf: Make perf able to build with latest libbfd 2020-01-30 11:55:26 +01:00
srcline.h
stat-display.c perf stat: Align the output for interval aggregation mode 2020-03-24 09:37:27 -03:00
stat-shadow.c perf stat: Fix no metric header if --per-socket and --metric-only set 2020-04-14 08:49:26 -03:00
stat.c perf stat: Use affinity for opening events 2019-11-29 12:20:45 -03:00
stat.h perf stat: Show percore counts in per CPU output 2020-03-04 10:34:09 -03:00
strbuf.c
strbuf.h
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf symbols: Consolidate symbol fixup issue 2020-03-23 11:08:29 -03:00
symbol-minimal.c
symbol.c perf symbols: Don't try to find a vmlinux file when looking for kernel modules 2020-03-03 16:20:01 -03:00
symbol.h perf maps: Rename 'mg' variables to 'maps' 2019-11-26 11:07:46 -03:00
symbol_conf.h perf report: Allow specifying event to be used as sort key in --group output 2020-03-24 09:37:27 -03:00
symbol_fprintf.c
symsrc.h
synthetic-events.c perf record: Support synthesizing cgroup events 2020-04-03 09:37:55 -03:00
synthetic-events.h perf record: Support synthesizing cgroup events 2020-04-03 09:37:55 -03:00
syscalltbl.c
syscalltbl.h
target.c
target.h
term.c
term.h
thread-stack.c perf thread: Rename thread->mg to thread->maps 2019-11-26 11:07:46 -03:00
thread-stack.h
thread.c perf thread: Rename thread->mg to thread->maps 2019-11-26 11:07:46 -03:00
thread.h perf thread: Rename thread->mg to thread->maps 2019-11-26 11:07:46 -03:00
thread_map.c
thread_map.h
time-utils.c
time-utils.h
tool.h perf record: Support synthesizing cgroup events 2020-04-03 09:37:55 -03:00
top.c
top.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c
trace-event.c
trace-event.h
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c perf map_symbol: Rename ms->mg to ms->maps 2019-11-26 11:07:46 -03:00
unwind-libdw.h
unwind-libunwind-local.c perf maps: Rename 'mg' variables to 'maps' 2019-11-26 11:07:46 -03:00
unwind-libunwind.c perf maps: Rename 'mg' variables to 'maps' 2019-11-26 11:07:46 -03:00
unwind.h perf maps: Merge 'struct maps' with 'struct map_groups' 2019-11-26 11:07:46 -03:00
usage.c
util.c perf util: Factor out sysctl__nmi_watchdog_enabled() 2020-03-10 14:46:19 -03:00
util.h perf util: Factor out sysctl__nmi_watchdog_enabled() 2020-03-10 14:46:19 -03:00
values.c
values.h
vdso.c perf thread: Rename thread->mg to thread->maps 2019-11-26 11:07:46 -03:00
vdso.h
xyarray.c
zlib.c
zstd.c