linux-stable/tools/perf/util
Jiri Olsa 82bf311e15 perf stat: Use group read for event groups
Make perf stat use  group read if there  are groups defined. The group
read will get the values for all member of groups within a single
syscall instead of calling read syscall for every event.

We can see considerable less amount of kernel cycles spent on single
group read, than reading each event separately, like for following perf
stat command:

  # perf stat -e {cycles,instructions} -I 10 -a sleep 1

Monitored with "perf stat -r 5 -e '{cycles:u,cycles:k}'"

Before:

        24,325,676      cycles:u
       297,040,775      cycles:k

       1.038554134 seconds time elapsed

After:
        25,034,418      cycles:u
       158,256,395      cycles:k

       1.036864497 seconds time elapsed

The perf_evsel__open fallback changes contributed by Andi Kleen.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
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/20170726120206.9099-4-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2017-07-26 14:25:44 -03:00
..
c++ perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
include perf probe: Support probing on offline cross-arch binary 2016-09-01 12:41:09 -03:00
intel-pt-decoder perf intel-pt: Do not use TSC packets for calculating CPU cycles to TSC 2017-06-30 11:50:55 -03:00
libunwind perf unwind: Fix wrongly used regs for aarch64 unwind 2016-06-23 10:30:31 -03:00
scripting-engines perf script python: Generate hooks with additional argument 2017-07-25 22:43:21 -03:00
annotate.c perf annotate stdio: Fix column header when using --show-total-period 2017-07-25 22:46:37 -03:00
annotate.h perf annotate: Store the sample period in each histogram bucket 2017-07-21 12:02:38 -03:00
auxtrace.c perf auxtrace: Add CPU filter support 2017-06-30 11:50:55 -03:00
auxtrace.h perf auxtrace: Add CPU filter support 2017-06-30 11:50:55 -03:00
block-range.c perf annotate: Add branch stack / basic block 2016-09-08 13:44:03 -03:00
block-range.h perf annotate: Add branch stack / basic block 2016-09-08 13:44:03 -03:00
bpf-loader.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
bpf-loader.h perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
bpf-prologue.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
bpf-prologue.h perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
branch.c perf util: Create branch.c/.h for common branch functions 2017-07-18 23:14:40 -03:00
branch.h perf report: Tag branch type/flag on "to" and tag cycles on "from" 2017-07-25 22:46:35 -03:00
Build perf util: Create branch.c/.h for common branch functions 2017-07-18 23:14:40 -03:00
build-id.c perf header: Add struct feat_fd for write 2017-07-18 23:14:31 -03:00
build-id.h perf header: Add struct feat_fd for write 2017-07-18 23:14:31 -03:00
cache.h tools: Adopt __printf from kernel sources 2017-06-19 15:25:26 -03:00
call-path.c perf tools: Refactor code to move call path handling out of thread-stack 2016-05-06 13:00:43 -03:00
call-path.h perf tools: Refactor code to move call path handling out of thread-stack 2016-05-06 13:00:43 -03:00
callchain.c perf report: Tag branch type/flag on "to" and tag cycles on "from" 2017-07-25 22:46:35 -03:00
callchain.h perf report: Show branch type in callchain entry 2017-07-18 23:14:42 -03:00
cgroup.c perf cgroup: Fix refcount usage 2017-07-25 11:23:50 -03:00
cgroup.h perf cgroup: Convert cgroup_sel.refcnt from atomic_t to refcount_t 2017-03-03 19:07:14 -03:00
cloexec.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
cloexec.h tools build: Add test for sched_getcpu() 2017-03-03 19:07:19 -03:00
color.c perf tools: Uninline scnprintf() and vscnprint() 2016-07-12 15:20:24 -03:00
color.h perf tools: Remove string.h, unistd.h and sys/stat.h from util.h 2017-04-24 13:43:33 -03:00
comm.c perf tools: Remove string.h from util.h 2017-04-24 13:43:32 -03:00
comm.h
compress.h perf tools: Add compress.h for the *_decompress_to_file() headers 2017-04-24 12:33:33 -03:00
config.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
config.h perf config: Do not die when parsing u64 or int config values 2017-06-27 11:44:58 -03:00
counts.c perf tools: Move path related functions to util/path.h 2017-04-19 13:01:53 -03:00
counts.h perf stat: Use group read for event groups 2017-07-26 14:25:44 -03:00
cpumap.c perf tools: Remove include dirent.h from util.h 2017-04-19 13:01:55 -03:00
cpumap.h perf cpumap: Introduce cpu_map__snprint_mask() 2017-03-03 19:07:17 -03:00
cs-etm.h perf tools: Add coresight etm PMU record capabilities 2016-09-22 12:19:40 -03:00
ctype.c perf tools: Move sane ctype stuff from util.h to sane_ctype.h 2017-04-19 13:01:48 -03:00
data-convert-bt.c perf config: Do not die when parsing u64 or int config values 2017-06-27 11:44:58 -03:00
data-convert-bt.h perf data ctf: Pass convert options through opts structure 2016-06-28 10:54:55 -03:00
data-convert.h perf data ctf: Add 'all' option 2016-06-28 10:54:56 -03:00
data.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
data.h perf data: Add perf_data_file__switch() helper 2016-04-14 08:57:54 -03:00
db-export.c perf thread: Adopt get_main_thread from db-export.c 2016-05-30 12:41:43 -03:00
db-export.h perf script: Add call path id to exported sample in db export 2016-05-06 13:00:53 -03:00
debug.c perf tools: Remove poll.h and wait.h from util.h 2017-04-24 13:43:34 -03:00
debug.h tools: Adopt __printf from kernel sources 2017-06-19 15:25:26 -03:00
demangle-java.c perf tools: Move sane ctype stuff from util.h to sane_ctype.h 2017-04-19 13:01:48 -03:00
demangle-java.h
demangle-rust.c perf symbols: Add Rust demangling 2016-07-12 16:12:38 -03:00
demangle-rust.h perf symbols: Add Rust demangling 2016-07-12 16:12:38 -03:00
drv_configs.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
drv_configs.h perf pmu: Push configuration down to PMU driver 2016-09-22 12:19:41 -03:00
dso.c perf buildid-cache: Cache debuginfo 2017-07-18 23:14:11 -03:00
dso.h perf buildid-cache: Cache debuginfo 2017-07-18 23:14:11 -03:00
dump-insn.c perf script: Add 'brstackinsn' for branch stacks 2017-03-16 09:24:35 -03:00
dump-insn.h perf script: Add 'brstackinsn' for branch stacks 2017-03-16 09:24:35 -03:00
dwarf-aux.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
dwarf-aux.h perf probe: Match linkage name with mangled name 2016-09-29 11:17:08 -03:00
dwarf-regs.c perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used 2017-04-19 13:01:44 -03:00
env.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
env.h perf header: Transform nodes string info to struct 2016-07-04 19:39:01 -03:00
event.c perf tools: Add feature header record to pipe-mode 2017-07-18 23:14:36 -03:00
event.h perf util: Create branch.c/.h for common branch functions 2017-07-18 23:14:40 -03:00
evlist.c perf evlist: Allow asking for max precise_ip in add_default() 2017-07-18 23:14:12 -03:00
evlist.h perf evlist: Allow asking for max precise_ip in add_default() 2017-07-18 23:14:12 -03:00
evsel.c perf stat: Use group read for event groups 2017-07-26 14:25:44 -03:00
evsel.h perf evsel: Add read_counter() 2017-07-26 14:21:59 -03:00
evsel_fprintf.c perf script: Add --inline option for debugging 2017-05-24 08:41:48 +02:00
expr.h perf tools: Add a simple expression parser for JSON 2017-03-23 11:39:27 -03:00
expr.y perf tools: Add a simple expression parser for JSON 2017-03-23 11:39:27 -03:00
find-vdso-map.c
genelf.c perf jit: Generate .eh_frame/.eh_frame_hdr in DSO 2016-10-24 11:07:40 -03:00
genelf.h perf jit: Generate .eh_frame/.eh_frame_hdr in DSO 2016-10-24 11:07:40 -03:00
genelf_debug.c tools: Adopt __packed from kernel sources 2017-06-19 15:27:07 -03:00
generate-cmdlist.sh
group.h perf stat: Basic support for TopDown in perf stat 2016-06-06 17:04:15 -03:00
header.c perf header: Add event desc to pipe-mode header 2017-07-18 23:14:37 -03:00
header.h perf tools: Add feature header record to pipe-mode 2017-07-18 23:14:36 -03:00
help-unknown-cmd.c perf config: Do not die when parsing u64 or int config values 2017-06-27 11:44:58 -03:00
help-unknown-cmd.h
hist.c perf report: Make --branch-history work without callgraphs(-g) option in perf record 2017-07-25 22:46:03 -03:00
hist.h perf tools: Add 'cgroup_id' sort order keyword 2017-03-14 15:17:37 -03:00
intel-bts.c perf intel-pt/bts: Remove unused SAMPLE_SIZE defines and bts priv array 2017-06-19 15:27:09 -03:00
intel-bts.h
intel-pt.c perf intel-pt: Synthesize new power and "ptwrite" events 2017-06-30 11:48:28 -03:00
intel-pt.h perf intel-pt: Record address filter in AUXTRACE_INFO event 2016-09-29 11:17:05 -03:00
intlist.c
intlist.h perf intlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:39:19 -03:00
jit.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
jitdump.c perf str{filter,list}: Disentangle headers 2017-04-19 13:01:52 -03:00
jitdump.h perf jit: Add unwinding support 2016-10-24 11:07:39 -03:00
kvm-stat.h
levenshtein.c perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
levenshtein.h
llvm-utils.c tools include: Adopt strstarts() from the kernel 2017-07-20 15:46:10 -03:00
llvm-utils.h perf llvm: Extract helpers in llvm-utils.c 2016-12-05 15:51:42 -03:00
lzma.c perf tools: Add compress.h for the *_decompress_to_file() headers 2017-04-24 12:33:33 -03:00
machine.c perf report: Make --branch-history work without callgraphs(-g) option in perf record 2017-07-25 22:46:03 -03:00
machine.h perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info 2017-03-14 11:38:23 -03:00
map.c perf maps: Lookup maps in both intitial mountns and inner mountns. 2017-07-18 23:14:09 -03:00
map.h perf maps: Lookup maps in both intitial mountns and inner mountns. 2017-07-18 23:14:09 -03:00
mem-events.c perf mem: Fix display of data source snoop indication 2017-04-24 12:33:32 -03:00
mem-events.h perf c2c report: Add struct c2c_stats::tot_hitm field 2016-11-23 10:44:05 -03:00
memswap.c perf memswap: Split the byteswap memory range wrappers from util.[ch] 2017-04-25 15:45:35 -03:00
memswap.h perf memswap: Split the byteswap memory range wrappers from util.[ch] 2017-04-25 15:45:35 -03:00
namespaces.c perf probe: Allow placing uprobes in alternate namespaces. 2017-07-18 23:14:10 -03:00
namespaces.h perf probe: Allow placing uprobes in alternate namespaces. 2017-07-18 23:14:10 -03:00
ordered-events.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
ordered-events.h perf ordered_events: Introduce reinit() 2016-04-14 08:57:54 -03:00
parse-branch-options.c perf record: Create a new option save_type in --branch-filter 2017-07-18 23:14:39 -03:00
parse-branch-options.h perf tools: Implement branch_type event parameter 2016-10-24 11:07:35 -03:00
parse-events.c perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
parse-events.h perf list: Move extra details printing to new option 2017-03-23 11:42:31 -03:00
parse-events.l perf jevents: Handle events including .c and .o 2016-10-17 11:24:18 -03:00
parse-events.y perf pmu: Special case uncore_ prefix 2017-03-21 16:10:59 -03:00
parse-regs-options.c
parse-regs-options.h
path.c perf tools: Move path related functions to util/path.h 2017-04-19 13:01:53 -03:00
path.h perf tools: Move path related functions to util/path.h 2017-04-19 13:01:53 -03:00
perf-hooks-list.h perf tools: Introduce perf hooks 2016-11-29 12:13:27 -03:00
perf-hooks.c perf tools: Add include <linux/kernel.h> where ARRAY_SIZE() is used 2017-04-19 13:01:44 -03:00
perf-hooks.h perf tools: Pass context to perf hook functions 2016-12-05 15:51:42 -03:00
PERF-VERSION-GEN
perf_regs.c perf/sdt/x86: Move OP parser to tools/perf/arch/x86/ 2017-03-28 12:25:30 -03:00
perf_regs.h perf/sdt/x86: Move OP parser to tools/perf/arch/x86/ 2017-03-28 12:25:30 -03:00
pmu.c perf tools: Remove string.h, unistd.h and sys/stat.h from util.h 2017-04-24 13:43:33 -03:00
pmu.h tools: Adopt __scanf from kernel sources 2017-06-19 15:27:05 -03:00
pmu.l
pmu.y
print_binary.c perf tools: Move print_binary definitions to separate files 2017-04-19 13:01:50 -03:00
print_binary.h perf tools: Move print_binary definitions to separate files 2017-04-19 13:01:50 -03:00
probe-event.c perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
probe-event.h perf probe: Allow placing uprobes in alternate namespaces. 2017-07-18 23:14:10 -03:00
probe-file.c perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
probe-file.h perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
probe-finder.c perf str{filter,list}: Disentangle headers 2017-04-19 13:01:52 -03:00
probe-finder.h perf tools: Move sane ctype stuff from util.h to sane_ctype.h 2017-04-19 13:01:48 -03:00
pstack.c
pstack.h
python-ext-sources perf buildid-cache: Support binary objects from other namespaces 2017-07-18 23:14:11 -03:00
python.c perf callchain: Move callchain specific routines from util.[ch] 2017-04-24 13:43:26 -03:00
quote.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
quote.h perf quote: Disentangle headers 2016-07-12 15:19:55 -03:00
rb_resort.h perf rb_resort: Rename for_each() macros to for_each_entry() 2016-06-23 11:35:07 -03:00
rblist.c
rblist.h
record.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
sane_ctype.h perf tools: Move sane ctype stuff from util.h to sane_ctype.h 2017-04-19 13:01:48 -03:00
session.c perf tools: Add feature header record to pipe-mode 2017-07-18 23:14:36 -03:00
session.h perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
setns.c tools build: Add test for setns() 2017-07-18 23:14:08 -03:00
setup.py perf python: Filter out -specs=/a/b/c from the python binding cc options 2017-02-17 10:31:13 -03:00
sort.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
sort.h perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
srcline.c perf report: Do not drop last inlined frame 2017-05-24 08:41:48 +02:00
srcline.h perf tools: Move srcline definitions to separate header 2017-04-19 13:01:50 -03:00
stat-shadow.c perf stat: Add support to measure SMI cost 2017-06-21 11:35:35 -03:00
stat.c perf evsel: Add read_counter() 2017-07-26 14:21:59 -03:00
stat.h perf evsel: Add read_counter() 2017-07-26 14:21:59 -03:00
strbuf.c tools lib string: Adopt prefixcmp() from perf and subcmd 2017-04-26 15:49:21 -03:00
strbuf.h tools: Adopt __printf from kernel sources 2017-06-19 15:25:26 -03:00
strfilter.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
strfilter.h
string.c perf tools: Move extra string util functions to util/string2.h 2017-04-19 13:01:51 -03:00
string2.h perf tools: Move extra string util functions to util/string2.h 2017-04-19 13:01:51 -03:00
strlist.c perf tools: Remove string.h, unistd.h and sys/stat.h from util.h 2017-04-24 13:43:33 -03:00
strlist.h perf tools: Rename strlist_for_each() macros to for_each_entry() 2016-06-23 11:35:01 -03:00
svghelper.c perf timechart: Use NSEC_PER_U?SEC 2016-08-23 15:37:33 -03:00
svghelper.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
symbol-elf.c perf symbols: Keep DSO->symtab_type after decompress 2017-06-08 15:39:26 -03:00
symbol-minimal.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
symbol.c perf buildid-cache: Cache debuginfo 2017-07-18 23:14:11 -03:00
symbol.h perf symbols: Allow user probes on versioned symbols 2017-05-02 18:23:11 -03:00
symbol_fprintf.c perf symbols: No need to check if sym->name is NULL 2017-02-13 17:22:34 -03:00
syscalltbl.c perf tools: Build syscall table .c header from kernel's syscall_64.tbl 2016-04-08 09:58:14 -03:00
syscalltbl.h perf tools: Allow generating per-arch syscall table arrays 2016-04-08 09:58:14 -03:00
target.c perf target: str_error_r() always returns the buffer it receives 2016-07-29 11:54:35 -03:00
target.h
term.c perf tools: Don't include terminal handling headers in util.h 2017-04-19 13:01:53 -03:00
term.h
thread-stack.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
thread-stack.h perf script: Add callindent option 2016-06-23 17:04:26 -03:00
thread.c perf symbols: Find symbols in different mount namespace 2017-07-18 23:14:09 -03:00
thread.h perf symbols: Find symbols in different mount namespace 2017-07-18 23:14:09 -03:00
thread_map.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
thread_map.h perf thread_map: Convert thread_map.refcnt from atomic_t to refcount_t 2017-03-03 19:07:16 -03:00
time-utils.c perf tools: Move timestamp routines from util.h to time-utils.h 2017-04-20 13:22:44 -03:00
time-utils.h perf tools: Move timestamp routines from util.h to time-utils.h 2017-04-20 13:22:44 -03:00
tool.h perf tools: Add feature header record to pipe-mode 2017-07-18 23:14:36 -03:00
top.c
top.h perf tools: Remove sys/ioctl.h from util.h 2017-04-24 13:43:32 -03:00
trace-event-info.c perf tools: Create for_each_event macro for tracepoints iteration 2017-01-31 16:20:08 -03:00
trace-event-parse.c perf event-parse: Use pr_warning() 2017-06-27 11:08:14 -03:00
trace-event-read.c perf utils: Null terminate buf in read_ftrace_printk() 2017-03-27 15:37:35 -03:00
trace-event-scripting.c perf scripting: Don't die if scripting can't be setup, disable it 2016-10-28 11:29:44 -02:00
trace-event.c perf tools: Introduce trace_event__tp_format_id() 2016-07-12 16:14:52 -03:00
trace-event.h perf util: Save pid-cmdline mapping into tracing header 2017-01-26 11:42:59 -03:00
trigger.h perf tools: Introduce trigger class 2016-04-28 09:58:58 -03:00
tsc.c
tsc.h perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
units.c perf units: Move parse_tag_value() to units.[ch] 2017-04-26 15:40:31 -03:00
units.h perf units: Move parse_tag_value() to units.[ch] 2017-04-26 15:40:31 -03:00
unwind-libdw.c perf unwind: Report module before querying isactivation in dwfl unwind 2017-06-16 14:37:30 -03:00
unwind-libdw.h perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
unwind-libunwind-local.c perf report: Fix off-by-one for non-activation frames 2017-05-24 08:41:48 +02:00
unwind-libunwind.c perf unwind: Do not fail due to missing unwind support 2017-07-04 11:43:58 -03:00
unwind.h perf unwind: Provide only forward declarations for pointer types 2017-04-20 13:22:43 -03:00
usage.c perf tools: Kill die() 2017-06-27 11:49:13 -03:00
util-cxx.h perf clang: Update test case to use real BPF script 2016-12-05 15:51:44 -03:00
util.c perf util: Add const modifier to buf in "writen" function 2017-07-18 23:14:29 -03:00
util.h perf util: Add const modifier to buf in "writen" function 2017-07-18 23:14:29 -03:00
values.c perf tools: Don't die on a print function 2017-04-04 12:11:07 -03:00
values.h perf tools: Use normal error reporting when processing PERF_RECORD_READ events 2016-10-24 11:07:44 -03:00
vdso.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
vdso.h
xyarray.c perf tools: Remove string.h from util.h 2017-04-24 13:43:32 -03:00
xyarray.h
zlib.c perf tools: Add compress.h for the *_decompress_to_file() headers 2017-04-24 12:33:33 -03:00