Skip to content

Commit 9d9af10

Browse files
committed
Merge tag 'perf-tools-for-v5.10-2020-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
Pull perf tools updates from Arnaldo Carvalho de Melo: - cgroup improvements for 'perf stat', allowing for compact specification of events and cgroups in the command line. - Support per thread topdown metrics in 'perf stat'. - Support sample-read topdown metric group in 'perf record' - Show start of latency in addition to its start in 'perf sched latency'. - Add min, max to 'perf script' futex-contention output, in addition to avg. - Allow usage of 'perf_event_attr->exclusive' attribute via the new ':e' event modifier. - Add 'snapshot' command to 'perf record --control', using it with Intel PT. - Support FIFO file names as alternative options to 'perf record --control'. - Introduce branch history "streams", to compare 'perf record' runs with 'perf diff' based on branch records and report hot streams. - Support PE executable symbol tables using libbfd, to profile, for instance, wine binaries. - Add filter support for option 'perf ftrace -F/--funcs'. - Allow configuring the 'disassembler_style' 'perf annotate' knob via 'perf config' - Update CascadelakeX and SkylakeX JSON vendor events files. - Add support for parsing perchip/percore JSON vendor events. - Add power9 hv_24x7 core level metric events. - Add L2 prefetch, ITLB instruction fetch hits JSON events for AMD zen1. - Enable Family 19h users by matching Zen2 AMD vendor events. - Use debuginfod in 'perf probe' when required debug files not found locally. - Display negative tid in non-sample events in 'perf script'. - Make GTK2 support opt-in - Add build test with GTK+ - Add missing -lzstd to the fast path feature detection - Add scripts to auto generate 'mmap', 'mremap' string<->id tables for use in 'perf trace'. - Show python test script in verbose mode. - Fix uncore metric expressions - Msan uninitialized use fixes. - Use condition variables in 'perf bench numa' - Autodetect python3 binary in systems without python2. - Support md5 build ids in addition to sha1. - Add build id 'perf test' regression test. - Fix printable strings in python3 scripts. - Fix off by ones in 'perf trace' in arches using libaudit. - Fix JSON event code for events referencing std arch events. - Introduce 'perf test' shell script for Arm CoreSight testing. - Add rdtsc() for Arm64 for used in the PERF_RECORD_TIME_CONV metadata event and in 'perf test tsc'. - 'perf c2c' improvements: Add "RMT Load Hit" metric, "Total Stores", fixes and documentation update. - Fix usage of reloc_sym in 'perf probe' when using both kallsyms and debuginfo files. - Do not print 'Metric Groups:' unnecessarily in 'perf list' - Refcounting fixes in the event parsing code. - Add expand cgroup event 'perf test' entry. - Fix out of bounds CPU map access when handling armv8_pmu events in 'perf stat'. - Add build-id injection 'perf bench' benchmark. - Enter namespace when reading build-id in 'perf inject'. - Do not load map/dso when injecting build-id speeding up the 'perf inject' process. - Add --buildid-all option to avoid processing all samples, just the mmap metadata events. - Add feature test to check if libbfd has buildid support - Add 'perf test' entry for PE binary format support. - Fix typos in power8 PMU vendor events JSON files. - Hide libtraceevent non API functions. * tag 'perf-tools-for-v5.10-2020-10-15' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (113 commits) perf c2c: Update documentation for metrics reorganization perf c2c: Add metrics "RMT Load Hit" perf c2c: Correct LLC load hit metrics perf c2c: Change header for LLC local hit perf c2c: Use more explicit headers for HITM perf c2c: Change header from "LLC Load Hitm" to "Load Hitm" perf c2c: Organize metrics based on memory hierarchy perf c2c: Display "Total Stores" as a standalone metrics perf c2c: Display the total numbers continuously perf bench: Use condition variables in numa. perf jevents: Fix event code for events referencing std arch events perf diff: Support hot streams comparison perf streams: Report hot streams perf streams: Calculate the sum of total streams hits perf streams: Link stream pair perf streams: Compare two streams perf streams: Get the evsel_streams by evsel_idx perf streams: Introduce branch history "streams" perf intel-pt: Improve PT documentation slightly perf tools: Add support for exclusive groups/events ...
2 parents a1e16bc + 744aec4 commit 9d9af10

164 files changed

Lines changed: 10449 additions & 5719 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tools/build/Makefile.feature

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ FEATURE_TESTS_BASIC := \
3838
get_current_dir_name \
3939
gettid \
4040
glibc \
41-
gtk2 \
42-
gtk2-infobar \
4341
libbfd \
42+
libbfd-buildid \
4443
libcap \
4544
libelf \
4645
libelf-getphdrnum \
@@ -80,6 +79,8 @@ FEATURE_TESTS_EXTRA := \
8079
compile-32 \
8180
compile-x32 \
8281
cplus-demangle \
82+
gtk2 \
83+
gtk2-infobar \
8384
hello \
8485
libbabeltrace \
8586
libbfd-liberty \
@@ -110,8 +111,8 @@ FEATURE_DISPLAY ?= \
110111
dwarf \
111112
dwarf_getlocations \
112113
glibc \
113-
gtk2 \
114114
libbfd \
115+
libbfd-buildid \
115116
libcap \
116117
libelf \
117118
libnuma \

tools/build/feature/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ FILES= \
1515
test-hello.bin \
1616
test-libaudit.bin \
1717
test-libbfd.bin \
18+
test-libbfd-buildid.bin \
1819
test-disassembler-four-args.bin \
1920
test-reallocarray.bin \
2021
test-libbfd-liberty.bin \
@@ -89,7 +90,7 @@ __BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(
8990
###############################
9091

9192
$(OUTPUT)test-all.bin:
92-
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma
93+
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -I/usr/include/slang -lslang $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl -lz -llzma -lzstd
9394

9495
$(OUTPUT)test-hello.bin:
9596
$(BUILD)
@@ -225,6 +226,9 @@ $(OUTPUT)test-libpython-version.bin:
225226
$(OUTPUT)test-libbfd.bin:
226227
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
227228

229+
$(OUTPUT)test-libbfd-buildid.bin:
230+
$(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
231+
228232
$(OUTPUT)test-disassembler-four-args.bin:
229233
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
230234

tools/build/feature/test-all.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,14 @@
7474
# include "test-libslang.c"
7575
#undef main
7676

77-
#define main main_test_gtk2
78-
# include "test-gtk2.c"
79-
#undef main
80-
81-
#define main main_test_gtk2_infobar
82-
# include "test-gtk2-infobar.c"
83-
#undef main
84-
8577
#define main main_test_libbfd
8678
# include "test-libbfd.c"
8779
#undef main
8880

81+
#define main main_test_libbfd_buildid
82+
# include "test-libbfd-buildid.c"
83+
#undef main
84+
8985
#define main main_test_backtrace
9086
# include "test-backtrace.c"
9187
#undef main
@@ -201,9 +197,8 @@ int main(int argc, char *argv[])
201197
main_test_libelf_getshdrstrndx();
202198
main_test_libunwind();
203199
main_test_libslang();
204-
main_test_gtk2(argc, argv);
205-
main_test_gtk2_infobar(argc, argv);
206200
main_test_libbfd();
201+
main_test_libbfd_buildid();
207202
main_test_backtrace();
208203
main_test_libnuma();
209204
main_test_numa_num_possible_cpus();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include <bfd.h>
3+
4+
int main(void)
5+
{
6+
bfd *abfd = bfd_openr("Pedro", 0);
7+
return abfd && (!abfd->build_id || abfd->build_id->size > 0x506564726f);
8+
}

tools/lib/perf/evlist.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ static void __perf_evlist__propagate_maps(struct perf_evlist *evlist,
4545
if (!evsel->own_cpus || evlist->has_user_cpus) {
4646
perf_cpu_map__put(evsel->cpus);
4747
evsel->cpus = perf_cpu_map__get(evlist->cpus);
48+
} else if (!evsel->system_wide && perf_cpu_map__empty(evlist->cpus)) {
49+
perf_cpu_map__put(evsel->cpus);
50+
evsel->cpus = perf_cpu_map__get(evlist->cpus);
4851
} else if (evsel->cpus != evsel->own_cpus) {
4952
perf_cpu_map__put(evsel->cpus);
5053
evsel->cpus = perf_cpu_map__get(evsel->own_cpus);

tools/lib/perf/include/perf/event.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,20 @@ struct perf_record_header_tracing_data {
201201
__u32 size;
202202
};
203203

204+
#define PERF_RECORD_MISC_BUILD_ID_SIZE (1 << 15)
205+
204206
struct perf_record_header_build_id {
205207
struct perf_event_header header;
206208
pid_t pid;
207-
__u8 build_id[24];
209+
union {
210+
__u8 build_id[24];
211+
struct {
212+
__u8 data[20];
213+
__u8 size;
214+
__u8 reserved1__;
215+
__u16 reserved2__;
216+
};
217+
};
208218
char filename[];
209219
};
210220

@@ -324,6 +334,10 @@ struct perf_record_time_conv {
324334
__u64 time_shift;
325335
__u64 time_mult;
326336
__u64 time_zero;
337+
__u64 time_cycles;
338+
__u64 time_mask;
339+
bool cap_user_time_zero;
340+
bool cap_user_time_short;
327341
};
328342

329343
struct perf_record_header_feature {

tools/lib/traceevent/event-parse-api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ bool tep_test_flag(struct tep_handle *tep, enum tep_flag flag)
9292
return false;
9393
}
9494

95-
unsigned short tep_data2host2(struct tep_handle *tep, unsigned short data)
95+
__hidden unsigned short data2host2(struct tep_handle *tep, unsigned short data)
9696
{
9797
unsigned short swap;
9898

@@ -105,7 +105,7 @@ unsigned short tep_data2host2(struct tep_handle *tep, unsigned short data)
105105
return swap;
106106
}
107107

108-
unsigned int tep_data2host4(struct tep_handle *tep, unsigned int data)
108+
__hidden unsigned int data2host4(struct tep_handle *tep, unsigned int data)
109109
{
110110
unsigned int swap;
111111

@@ -120,8 +120,8 @@ unsigned int tep_data2host4(struct tep_handle *tep, unsigned int data)
120120
return swap;
121121
}
122122

123-
unsigned long long
124-
tep_data2host8(struct tep_handle *tep, unsigned long long data)
123+
__hidden unsigned long long
124+
data2host8(struct tep_handle *tep, unsigned long long data)
125125
{
126126
unsigned long long swap;
127127

tools/lib/traceevent/event-parse-local.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct event_handler;
1515
struct func_resolver;
1616
struct tep_plugins_dir;
1717

18+
#define __hidden __attribute__((visibility ("hidden")))
19+
1820
struct tep_handle {
1921
int ref_count;
2022

@@ -102,12 +104,20 @@ struct tep_print_parse {
102104
struct tep_print_arg *len_as_arg;
103105
};
104106

105-
void tep_free_event(struct tep_event *event);
106-
void tep_free_format_field(struct tep_format_field *field);
107-
void tep_free_plugin_paths(struct tep_handle *tep);
108-
109-
unsigned short tep_data2host2(struct tep_handle *tep, unsigned short data);
110-
unsigned int tep_data2host4(struct tep_handle *tep, unsigned int data);
111-
unsigned long long tep_data2host8(struct tep_handle *tep, unsigned long long data);
107+
void free_tep_event(struct tep_event *event);
108+
void free_tep_format_field(struct tep_format_field *field);
109+
void free_tep_plugin_paths(struct tep_handle *tep);
110+
111+
unsigned short data2host2(struct tep_handle *tep, unsigned short data);
112+
unsigned int data2host4(struct tep_handle *tep, unsigned int data);
113+
unsigned long long data2host8(struct tep_handle *tep, unsigned long long data);
114+
115+
/* access to the internal parser */
116+
int peek_char(void);
117+
void init_input_buf(const char *buf, unsigned long long size);
118+
unsigned long long get_input_buf_ptr(void);
119+
const char *get_input_buf(void);
120+
enum tep_event_type read_token(char **tok);
121+
void free_token(char *tok);
112122

113123
#endif /* _PARSE_EVENTS_INT_H */

0 commit comments

Comments
 (0)