perf tools: fixes and tweaks
Adrian Hunter
reviewerv3 cover perf tools: fixes and tweaks
Hi
Here are some fixes and tweaks (version 3) for perf tools.
Changes in V3:
perf evsel: Always use perf_evsel__set_sample_bit()
New patch
perf evsel: Add missing overflow check
New patch
perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
New patch
perf evsel: Add missing PERF_SAMPLE_TRANSACTION
New patch
Patches dropped because they have been applied:
perf tools: Fix non-debug build
perf inject: Do not repipe attributes to a perf.data file
Changes in V2:
perf tools: Fix non-debug build
New patch
perf evsel: Add a debug print if perf_event_open fails
Unchanged
perf script: Make perf_script a local variable
Split from "perf script: Set up output options for in-stream attributes"
perf script: Set up output options for in-stream attributes
Split out "perf script: Make perf_script a local variable"
perf inject: Do not repipe attributes to a perf.data file
Unchanged
perf tools: Fix 32-bit cross build
Pass only EXTRA_CFLAGS
perf tools: Fix libunwind build and feature detection for 32-bit build
Add Jiri's Ack
perf evlist: Add a debug print if event buffer mmap fails
Add errno
perf tools: Allow non-matching sample types
Suppress compatible sample types for trace tool
perf sched: Make struct perf_sched sched a local variable
New patch
perf sched: Fix optimized build time
New patch
perf tools: Do not accept parse_tag_value() overflow
New patch
perf tools: Validate that mmap_pages is not too big
New patch
Patches dropped because they have been applied:
perf evsel: Add missing 'mmap2' from debug print perf record: Improve write_output error message perf evsel: Add missing decrement in id sample parsing perf session: Add missing sample flush for piped events perf session: Add missing members to perf_event__attr_swap() perf evlist: Fix 32-bit build error
perf tools: Fix test_on_exit for 32-bit build perf tools: Fix bench/numa.c for 32-bit build perf tools: fix perf_evlist__mmap comments
perf tools: factor out duplicated evlist mmap code perf script: print addr by default for BTS
Adrian Hunter (11):
perf evsel: Add a debug print if perf_event_open fails perf script: Set up output options for in-stream attributes perf tools: Fix 32-bit cross build
perf tools: Fix libunwind build and feature detection for 32-bit build perf evlist: Add a debug print if event buffer mmap fails perf record: Add an option to force per-cpu mmaps
perf evsel: Always use perf_evsel__set_sample_bit()
perf evsel: Add missing overflow check
perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION perf evsel: Add missing PERF_SAMPLE_TRANSACTION
perf tools: Allow non-matching sample types
tools/perf/Documentation/perf-record.txt | 6 +++ tools/perf/Makefile.perf | 2 +- tools/perf/builtin-record.c | 2 + tools/perf/builtin-script.c | 64 +++++++++++++++++++++++-------- tools/perf/builtin-trace.c | 1 + tools/perf/config/Makefile | 8 ++-- tools/perf/config/feature-checks/Makefile | 6 +-- tools/perf/perf.h | 1 + tools/perf/tests/sample-parsing.c | 7 +++- tools/perf/util/event.h | 16 ++++++++ tools/perf/util/evlist.c | 31 ++++++++++++++- tools/perf/util/evlist.h | 1 + tools/perf/util/evsel.c | 21 +++++++--- tools/perf/util/record.c | 5 ++- tools/perf/util/target.h | 1 + 15 files changed, 141 insertions(+), 31 deletions(-)
Regards
Adrian
Adrian Hunter
reviewerPATCH v3 1/11 perf evsel: Add a debug print if perf_event_open fails
There is a debug print (at verbose level 2) for each call to perf_event_open. Add another debug print if the call fails, and print the error number.
--- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evsel.c +2 -0
@@ -1052,6 +1052,8 @@ retry_open: group_fd, flags);if (FD (evsel, cpu, thread) <0 ) { err = -errno; +pr_debug2 ("perf_event_open failed, error %d\n" , + err); goto try_fallback; } set_rlimit =NO_CHANGE ;
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf evsel: Add a debug print if perf_event_open fails
perf evsel: Add a debug print if perf_event_open fails
Commit-ID: f852fd621ca19f557f2e3d05900366be7c7afb83 Gitweb: http://git.kernel.org/tip/f852fd621ca19f557f2e3d05900366be7c7afb83 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:29 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:18:17 -0300
perf evsel: Add a debug print if perf_event_open fails
There is a debug print (at verbose level 2) for each call to perf_event_open. Add another debug print if the call fails, and print the error number.
--- tools/perf/util/evsel.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evsel.c +2 -0
@@ -1051,6 +1051,8 @@ retry_open: group_fd, flags);if (FD (evsel, cpu, thread) <0 ) { err = -errno; +pr_debug2 ("perf_event_open failed, error %d\n" , + err); goto try_fallback; } set_rlimit =NO_CHANGE ;
Adrian Hunter
reviewerPATCH v3 2/11 perf script: Set up output options for in-stream attributes
In reply to Adrian HunterAttributes (struct perf_event_attr) are recorded separately in the perf.data file. perf script uses them to set up output options. However attributes can also be in the event stream, for example when the input is a pipe (i.e. live mode). This patch makes perf script process in-stream attributes in the same way as on-file attributes.
Here is an example:
Before this patch:
$ perf record uname | perf script Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ] :4220 4220 [-01] 2933367.838906: cycles:
:4220 4220 [-01] 2933367.838910: cycles:
:4220 4220 [-01] 2933367.838912: cycles:
:4220 4220 [-01] 2933367.838914: cycles:
:4220 4220 [-01] 2933367.838916: cycles:
:4220 4220 [-01] 2933367.838918: cycles:
uname 4220 [-01] 2933367.838938: cycles:
uname 4220 [-01] 2933367.839207: cycles:
After this patch:
$ perf record uname | perf script
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
:4582 4582 2933425.707724: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707728: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707730: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707732: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707734: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707736: cycles: ffffffff81309a24 memcpy ([kernel.kallsyms])
uname 4582 2933425.707760: cycles: ffffffff8109c1c7 enqueue_task_fair ([kernel.kallsyms])
uname 4582 2933425.707978: cycles: ffffffff81308457 clear_page_c ([kernel.kallsyms])--- tools/perf/builtin-script.c | 64 +++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-)
tools/perf/builtin-script.c +48 -16
@@ -229,6 +229,24 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,return 0 ; } +static void set_print_ip_opts (struct perf_event_attr *attr) +{ +unsigned int type = attr->type; + + output[type].print_ip_opts =0 ; +if (PRINT_FIELD (IP )) + output[type].print_ip_opts |=PRINT_IP_OPT_IP ; + +if (PRINT_FIELD (SYM )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYM ; + +if (PRINT_FIELD (DSO )) + output[type].print_ip_opts |=PRINT_IP_OPT_DSO ; + +if (PRINT_FIELD (SYMOFFSET )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +} +/* * verify all user requested events exist and the samples * have the expected data
@@ -237,7 +255,6 @@ static int perf_session__check_output_opt(struct perf_session *session) {int j;struct perf_evsel *evsel; -struct perf_event_attr *attr;for (j =0 ; j <PERF_TYPE_MAX ; ++j) { evsel =perf_session__find_first_evtype (session, j);
@@ -260,20 +277,7 @@ static int perf_session__check_output_opt(struct perf_session *session)if (evsel ==NULL )continue ; - attr = &evsel->attr; - - output[j].print_ip_opts =0 ; -if (PRINT_FIELD (IP )) - output[j].print_ip_opts |=PRINT_IP_OPT_IP ; - -if (PRINT_FIELD (SYM )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYM ; - -if (PRINT_FIELD (DSO )) - output[j].print_ip_opts |=PRINT_IP_OPT_DSO ; - -if (PRINT_FIELD (SYMOFFSET )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +set_print_ip_opts (&evsel->attr); }return 0 ;
@@ -547,6 +551,34 @@ struct perf_script {struct perf_session *session; }; +static int process_attr (struct perf_tool *tool,union perf_event *event, +struct perf_evlist **pevlist) +{ + struct perf_script *scr = container_of(tool, struct perf_script, tool); +struct perf_evlist *evlist; +struct perf_evsel *evsel, *pos; +int err; + + err =perf_event__process_attr (tool, event, pevlist); +if (err) +return err; + + evlist = *pevlist; + evsel =perf_evlist__last (*pevlist); + +if (evsel->attr.type >=PERF_TYPE_MAX ) +return 0 ; + +list_for_each_entry (pos, &evlist->entries, node) { +if (pos->attr.type == evsel->attr.type && pos != evsel) +return 0 ; + } + +set_print_ip_opts (&evsel->attr); + +return perf_evsel__check_attr (evsel, scr->session); +} +static void sig_handler (int sig__maybe_unused ) { session_done =1 ;
@@ -1272,7 +1304,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) .comm = perf_event__process_comm, .exit = perf_event__process_exit, .fork = perf_event__process_fork, - .attr = perf_event__process_attr, + .attr = process_attr, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf script: Set up output options for in-stream attributes
perf script: Set up output options for in-stream attributes
Commit-ID: 7ea95727af571d592c9d6aa7627690d44b114a2d Gitweb: http://git.kernel.org/tip/7ea95727af571d592c9d6aa7627690d44b114a2d Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:30 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:19:26 -0300
perf script: Set up output options for in-stream attributes
Attributes (struct perf_event_attr) are recorded separately in the perf.data file. perf script uses them to set up output options. However attributes can also be in the event stream, for example when the input is a pipe (i.e. live mode). This patch makes perf script process in-stream attributes in the same way as on-file attributes.
Here is an example:
Before this patch:
$ perf record uname | perf script Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ] :4220 4220 [-01] 2933367.838906: cycles:
:4220 4220 [-01] 2933367.838910: cycles:
:4220 4220 [-01] 2933367.838912: cycles:
:4220 4220 [-01] 2933367.838914: cycles:
:4220 4220 [-01] 2933367.838916: cycles:
:4220 4220 [-01] 2933367.838918: cycles:
uname 4220 [-01] 2933367.838938: cycles:
uname 4220 [-01] 2933367.839207: cycles:
After this patch:
$ perf record uname | perf script
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB (null) (~655 samples) ]
:4582 4582 2933425.707724: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707728: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707730: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707732: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707734: cycles: ffffffff81043ffa native_write_msr_safe ([kernel.kallsyms])
:4582 4582 2933425.707736: cycles: ffffffff81309a24 memcpy ([kernel.kallsyms])
uname 4582 2933425.707760: cycles: ffffffff8109c1c7 enqueue_task_fair ([kernel.kallsyms])
uname 4582 2933425.707978: cycles: ffffffff81308457 clear_page_c ([kernel.kallsyms])--- tools/perf/builtin-script.c | 64 +++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-)
tools/perf/builtin-script.c +48 -16
@@ -229,6 +229,24 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,return 0 ; } +static void set_print_ip_opts (struct perf_event_attr *attr) +{ +unsigned int type = attr->type; + + output[type].print_ip_opts =0 ; +if (PRINT_FIELD (IP )) + output[type].print_ip_opts |=PRINT_IP_OPT_IP ; + +if (PRINT_FIELD (SYM )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYM ; + +if (PRINT_FIELD (DSO )) + output[type].print_ip_opts |=PRINT_IP_OPT_DSO ; + +if (PRINT_FIELD (SYMOFFSET )) + output[type].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +} +/* * verify all user requested events exist and the samples * have the expected data
@@ -237,7 +255,6 @@ static int perf_session__check_output_opt(struct perf_session *session) {int j;struct perf_evsel *evsel; -struct perf_event_attr *attr;for (j =0 ; j <PERF_TYPE_MAX ; ++j) { evsel =perf_session__find_first_evtype (session, j);
@@ -260,20 +277,7 @@ static int perf_session__check_output_opt(struct perf_session *session)if (evsel ==NULL )continue ; - attr = &evsel->attr; - - output[j].print_ip_opts =0 ; -if (PRINT_FIELD (IP )) - output[j].print_ip_opts |=PRINT_IP_OPT_IP ; - -if (PRINT_FIELD (SYM )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYM ; - -if (PRINT_FIELD (DSO )) - output[j].print_ip_opts |=PRINT_IP_OPT_DSO ; - -if (PRINT_FIELD (SYMOFFSET )) - output[j].print_ip_opts |=PRINT_IP_OPT_SYMOFFSET ; +set_print_ip_opts (&evsel->attr); }return 0 ;
@@ -547,6 +551,34 @@ struct perf_script {struct perf_session *session; }; +static int process_attr (struct perf_tool *tool,union perf_event *event, +struct perf_evlist **pevlist) +{ + struct perf_script *scr = container_of(tool, struct perf_script, tool); +struct perf_evlist *evlist; +struct perf_evsel *evsel, *pos; +int err; + + err =perf_event__process_attr (tool, event, pevlist); +if (err) +return err; + + evlist = *pevlist; + evsel =perf_evlist__last (*pevlist); + +if (evsel->attr.type >=PERF_TYPE_MAX ) +return 0 ; + +list_for_each_entry (pos, &evlist->entries, node) { +if (pos->attr.type == evsel->attr.type && pos != evsel) +return 0 ; + } + +set_print_ip_opts (&evsel->attr); + +return perf_evsel__check_attr (evsel, scr->session); +} +static void sig_handler (int sig__maybe_unused ) { session_done =1 ;
@@ -1272,7 +1304,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) .comm = perf_event__process_comm, .exit = perf_event__process_exit, .fork = perf_event__process_fork, - .attr = perf_event__process_attr, + .attr = process_attr, .tracing_data = perf_event__process_tracing_data, .build_id = perf_event__process_build_id, .ordered_samples = true,
Adrian Hunter
reviewerPATCH v3 3/11 perf tools: Fix 32-bit cross build
In reply to Adrian HunterSetting EXTRA_CFLAGS=-m32 did not work because it
was not passed around.
--- tools/perf/Makefile.perf | 2 +- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/Makefile.perf +1 -1
@@ -709,7 +709,7 @@ $(LIB_FILE): $(LIB_OBJS) TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) $(LIBTRACEEVENT): $(TE_SOURCES) - $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a + $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) CFLAGS="-g -Wall $(EXTRA_CFLAGS)" libtraceevent.a $(LIBTRACEEVENT)-clean: $(call QUIET_CLEAN, libtraceevent)
tools/perf/config/Makefile +2 -2
@@ -96,7 +96,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
tools/perf/config/feature-checks/Makefile +1 -1
@@ -31,7 +31,7 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] +BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ###############################
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf tools: Fix 32-bit cross build
perf tools: Fix 32-bit cross build
Commit-ID: 28e962b9d79f496f214d7fc8ffd1a3f2a67e9090 Gitweb: http://git.kernel.org/tip/28e962b9d79f496f214d7fc8ffd1a3f2a67e9090 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:31 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:20:45 -0300
perf tools: Fix 32-bit cross build
Setting EXTRA_CFLAGS=-m32 did not work because it was not passed around.
--- tools/perf/Makefile.perf | 2 +- tools/perf/config/Makefile | 4 ++-- tools/perf/config/feature-checks/Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
tools/perf/Makefile.perf +1 -1
@@ -711,7 +711,7 @@ $(LIB_FILE): $(LIB_OBJS) TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch]) $(LIBTRACEEVENT): $(TE_SOURCES) - $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libtraceevent.a + $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) CFLAGS="-g -Wall $(EXTRA_CFLAGS)" libtraceevent.a $(LIBTRACEEVENT)-clean: $(call QUIET_CLEAN, libtraceevent)
tools/perf/config/Makefile +2 -2
@@ -96,7 +96,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
@@ -173,7 +173,7 @@ ifeq ($(feature-all), 1) # $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) + $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) endif
tools/perf/config/feature-checks/Makefile +1 -1
@@ -31,7 +31,7 @@ CC := $(CC) -MD all: $(FILES) -BUILD = $(CC) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] +BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ###############################
Adrian Hunter
reviewerPATCH v3 4/11 perf tools: Fix libunwind build and feature detection for 32-bit build
In reply to Adrian HunterUse -lunwind-x86 instead of -lunwind-x86_64 for
32-bit build.
--- tools/perf/config/Makefile | 6 ++++-- tools/perf/config/feature-checks/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +4 -2
@@ -25,9 +25,11 @@ ifeq ($(ARCH),x86_64) RAW_ARCH := x86_64 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S + LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 + else + LIBUNWIND_LIBS = -lunwind -lunwind-x86 endif NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 endif ifeq ($(NO_PERF_REGS),0)
@@ -96,7 +98,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
tools/perf/config/feature-checks/Makefile +2 -2
@@ -36,7 +36,7 @@ BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ############################### test-all: - $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -lelf -laudit -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 + $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -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 test-hello: $(BUILD)
@@ -72,7 +72,7 @@ test-libnuma: $(BUILD) -lnuma test-libunwind: - $(BUILD) -lunwind -lunwind-x86_64 -lelf + $(BUILD) $(LIBUNWIND_LIBS) -lelf test-libaudit: $(BUILD) -laudit
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf tools: Fix libunwind build and feature detection for 32-bit build
perf tools: Fix libunwind build and feature detection for 32-bit build
Commit-ID: 8a0c4c2843d3b72e23c3c12079b8d5c3ae99f3e3 Gitweb: http://git.kernel.org/tip/8a0c4c2843d3b72e23c3c12079b8d5c3ae99f3e3 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:32 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:21:18 -0300
perf tools: Fix libunwind build and feature detection for 32-bit build
Use -lunwind-x86 instead of -lunwind-x86_64 for 32-bit build.
--- tools/perf/config/Makefile | 6 ++++-- tools/perf/config/feature-checks/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-)
tools/perf/config/Makefile +4 -2
@@ -25,9 +25,11 @@ ifeq ($(ARCH),x86_64) RAW_ARCH := x86_64 CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S + LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 + else + LIBUNWIND_LIBS = -lunwind -lunwind-x86 endif NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 endif ifeq ($(NO_PERF_REGS),0)
@@ -96,7 +98,7 @@ endif feature_check = $(eval $(feature_check_code)) define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) + feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) endef feature_set = $(eval $(feature_set_code))
tools/perf/config/feature-checks/Makefile +2 -2
@@ -36,7 +36,7 @@ BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ [email protected] ############################### test-all: - $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -lelf -laudit -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 + $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -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 test-hello: $(BUILD)
@@ -72,7 +72,7 @@ test-libnuma: $(BUILD) -lnuma test-libunwind: - $(BUILD) -lunwind -lunwind-x86_64 -lelf + $(BUILD) $(LIBUNWIND_LIBS) -lelf test-libaudit: $(BUILD) -laudit
Adrian Hunter
reviewerPATCH v3 5/11 perf evlist: Add a debug print if event buffer mmap fails
In reply to Adrian HunterAdd a debug print if mmap of the perf event
ring buffer fails.
--- tools/perf/util/evlist.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evlist.c +2 -0
@@ -607,6 +607,8 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, evlist->mmap[idx].base =mmap (NULL , evlist->mmap_len, prot,MAP_SHARED , fd,0 );if (evlist->mmap[idx].base ==MAP_FAILED ) { +pr_debug2 ("failed to mmap perf event ring buffer, error %d\n" , + errno); evlist->mmap[idx].base =NULL ;return -1 ; }
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf evlist: Add a debug print if event buffer mmap fails
perf evlist: Add a debug print if event buffer mmap fails
Commit-ID: 026359658aecd348bc5c4a136a26f204b169103b Gitweb: http://git.kernel.org/tip/026359658aecd348bc5c4a136a26f204b169103b Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:33 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:21:41 -0300
perf evlist: Add a debug print if event buffer mmap fails
Add a debug print if mmap of the perf event ring buffer fails.
--- tools/perf/util/evlist.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/evlist.c +2 -0
@@ -607,6 +607,8 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, evlist->mmap[idx].base =mmap (NULL , evlist->mmap_len, prot,MAP_SHARED , fd,0 );if (evlist->mmap[idx].base ==MAP_FAILED ) { +pr_debug2 ("failed to mmap perf event ring buffer, error %d\n" , + errno); evlist->mmap[idx].base =NULL ;return -1 ; }
Adrian Hunter
reviewerPATCH v3 6/11 perf record: Add an option to force per-cpu mmaps
In reply to Adrian HunterBy default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
--- tools/perf/Documentation/perf-record.txt | 6 ++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-record.txt +6 -0
@@ -189,6 +189,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance. + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1]
tools/perf/builtin-record.c +2 -0
@@ -860,6 +860,8 @@ const struct option record_options[] = { "sample by weight (on special events only)"),OPT_BOOLEAN (0 ,"transaction" , &record.opts.sample_transaction,"sample transaction flags (special events only)" ), +OPT_BOOLEAN (0 ,"force-per-cpu" , &record.opts.target.force_per_cpu, +"force the use of per-cpu mmaps" ), OPT_END() };
tools/perf/util/evlist.c +3 -1
@@ -805,7 +805,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,if (evlist->threads ==NULL )return -1 ; -if (perf_target__has_task (target)) +if (target->force_per_cpu) + evlist->cpus =cpu_map__new (target->cpu_list); +else if (perf_target__has_task (target)) evlist->cpus =cpu_map__dummy_new ();else if (!perf_target__has_cpu (target) && !target->uses_mmap) evlist->cpus =cpu_map__dummy_new ();
tools/perf/util/evsel.c +2 -2
@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel, } } -if (perf_target__has_cpu (&opts->target)) +if (perf_target__has_cpu (&opts->target) || opts->target.force_per_cpu)perf_evsel__set_sample_bit (evsel,CPU );if (opts->period)
@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel,if (!perf_missing_features.sample_id_all && (opts->sample_time || !opts->no_inherit || -perf_target__has_cpu (&opts->target))) +perf_target__has_cpu (&opts->target) || opts->target.force_per_cpu))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples) {
tools/perf/util/target.h +1 -0
@@ -12,6 +12,7 @@ struct perf_target {uid_t uid;bool system_wide;bool uses_mmap; +bool force_per_cpu; };enum perf_target_errno {
Signature · 1 line
1.7.11.7
A message that is not in the archive (sent off-list or not yet received): [email protected]
Adrian Hunter
reviewerRe: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Quoted 31 lines · Jiri Olsa
Quoted 18 lines · Adrian Hunter
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/Documentation/perf-record.txt | 6 ++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-)tools/perf/Documentation/perf-record.txt +0
-0tools/perf/Documentation/perf-record.txt abort events and some memory events in precise mode on modern Intel CPUs. · line 196
Quoted 8 lines
tools/perf/Documentation/perf-record.txt +5
-0@@ -189,6 +189,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance.I recently sent out patch that actually force perf cpu mmaps for -p,-t,-u
http://marc.info/?l=linux-kernel&m=138332119912433&w=2
Quoted 3 lines
Is there a reason why would you want to keep single mmap (in record command) and cut yourself from inherited events?
Not sure I understand the question.
perf supports having a single context for a thread. That is a feature. You seem to be removing perf tools support for it.
I image a case where the user has hundreds of CPUs but just wants to record one thread. Currently -t does that. i.e. one file descriptor and one mmap saving megabytes of memory.
Another advantage of per-thread mmaps is that you do not need to sample time (nor cpu), because the events are recorded in order.
I was adding a feature. Users can choose per-cpu mmaps if they want.
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Quoted 45 lines · Adrian Hunter
Quoted 31 lines · Jiri Olsa
Quoted 18 lines · Adrian Hunter
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/Documentation/perf-record.txt | 6 ++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-)tools/perf/Documentation/perf-record.txt +0
-0tools/perf/Documentation/perf-record.txt abort events and some memory events in precise mode on modern Intel CPUs. · line 196
Quoted 8 lines
tools/perf/Documentation/perf-record.txt +5
-0@@ -189,6 +189,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance.I recently sent out patch that actually force perf cpu mmaps for -p,-t,-u
http://marc.info/?l=linux-kernel&m=138332119912433&w=2Quoted 3 lines
Is there a reason why would you want to keep single mmap (in record command) and cut yourself from inherited events?
Not sure I understand the question.
perf supports having a single context for a thread. That is a feature. You seem to be removing perf tools support for it.
I image a case where the user has hundreds of CPUs but just wants to record one thread. Currently -t does that. i.e. one file descriptor and one mmap saving megabytes of memory.
Quoted 6 lines
Another advantage of per-thread mmaps is that you do not need to sample time (nor cpu), because the events are recorded in order.
I was adding a feature. Users can choose per-cpu mmaps if they want.
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
jirka
Adrian Hunter
reviewerRe: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Quoted 50 lines · Jiri Olsa
Quoted 49 lines · Adrian Hunter
Quoted 31 lines · Jiri Olsa
Quoted 18 lines · Adrian Hunter
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>--- tools/perf/Documentation/perf-record.txt | 6 ++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-)tools/perf/Documentation/perf-record.txt +0
-0tools/perf/Documentation/perf-record.txt abort events and some memory events in precise mode on modern Intel CPUs. · line 196
Quoted 8 lines
tools/perf/Documentation/perf-record.txt +5
-0@@ -189,6 +189,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance.I recently sent out patch that actually force perf cpu mmaps for -p,-t,-u
http://marc.info/?l=linux-kernel&m=138332119912433&w=2Quoted 3 lines
Is there a reason why would you want to keep single mmap (in record command) and cut yourself from inherited events?
Not sure I understand the question.
perf supports having a single context for a thread. That is a feature. You seem to be removing perf tools support for it.
I image a case where the user has hundreds of CPUs but just wants to record one thread. Currently -t does that. i.e. one file descriptor and one mmap saving megabytes of memory.
Another advantage of per-thread mmaps is that you do not need to sample time (nor cpu), because the events are recorded in order.
Quoted 6 lines
Quoted 2 lines
I was adding a feature. Users can choose per-cpu mmaps if they want.
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
How about this:
From: Adrian Hunter <[email protected]>
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
--- tools/perf/Documentation/perf-record.txt | 15 +++++++++++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 23 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-record.txt +15 -0
@@ -53,14 +53,20 @@ OPTIONS -p:: --pid=:: Record events on existing process ID (comma separated list). + Note this causes the use of per-thread mmaps which prevents + inheritance. This can be overridden by --force-per-cpu. -t:: --tid=:: Record events on existing thread ID (comma separated list). + Note this causes the use of per-thread mmaps which prevents + inheritance. This can be overridden by --force-per-cpu. -u:: --uid=:: Record events in threads owned by uid. Name or number. + Note this causes the use of per-thread mmaps which prevents + inheritance. This can be overridden by --force-per-cpu. -r:: --realtime=::
@@ -81,6 +87,9 @@ OPTIONS -i:: --no-inherit:: Child tasks do not inherit counters. + Note that inheritance is not possible when events are recorded + with per-thread mmaps e.g. -p, -t or -u options. + -F:: --freq=:: Profile at this frequency.
@@ -201,6 +210,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance. + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1]
tools/perf/builtin-record.c +2 -0
@@ -889,6 +889,8 @@ const struct option record_options[] = { "sample by weight (on special events only)"),OPT_BOOLEAN (0 ,"transaction" , &record.opts.sample_transaction,"sample transaction flags (special events only)" ), +OPT_BOOLEAN (0 ,"force-per-cpu" , &record.opts.target.force_per_cpu, +"force the use of per-cpu mmaps" ), OPT_END() };
tools/perf/util/evlist.c +3 -1
@@ -805,7 +805,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist,if (evlist->threads ==NULL )return -1 ; -if (perf_target__has_task (target)) +if (target->force_per_cpu) + evlist->cpus =cpu_map__new (target->cpu_list); +else if (perf_target__has_task (target)) evlist->cpus =cpu_map__dummy_new ();else if (!perf_target__has_cpu (target) && !target->uses_mmap) evlist->cpus =cpu_map__dummy_new ();
tools/perf/util/evsel.c +2 -2
@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel, } } -if (perf_target__has_cpu (&opts->target)) +if (perf_target__has_cpu (&opts->target) || opts->target.force_per_cpu)perf_evsel__set_sample_bit (evsel,CPU );if (opts->period)
@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel,if (!perf_missing_features.sample_id_all && (opts->sample_time || !opts->no_inherit || -perf_target__has_cpu (&opts->target))) +perf_target__has_cpu (&opts->target) || opts->target.force_per_cpu))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples) {
tools/perf/util/target.h +1 -0
@@ -12,6 +12,7 @@ struct perf_target {uid_t uid;bool system_wide;bool uses_mmap; +bool force_per_cpu; };enum perf_target_errno {
Signature · 1 line
1.7.11.7
Jiri Olsa
Acked-byRe: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
On Tue, Nov 05, 2013 at 03:09:30PM +0200, Adrian Hunter wrote:
SNIP
Quoted 13 lines
Quoted 10 lines
Quoted 6 lines
Another advantage of per-thread mmaps is that you do not need to sample time (nor cpu), because the events are recorded in order.
I was adding a feature. Users can choose per-cpu mmaps if they want.
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
How about this:
Quoted 7 lines
From: Adrian Hunter <[email protected]>
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>
seems ok, thanks
jirka
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Em Tue, Nov 05, 2013 at 02:30:24PM +0100, Jiri Olsa escreveu:
Quoted 9 lines · Adrian Hunter
Quoted 8 lines
Quoted 3 lines
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
How about this:
From: Adrian Hunter <[email protected]>
Quoted 7 lines
Quoted 5 lines
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>seems ok, thanks
Much better, but may I ask that the explanation in the man pages be present in the changeset commit as well? So that by just looking at 'git log' we can more readily get the whole picture, i.e. scalability versus wanting to have inherit.
- Arnaldo
Quoted 3 lines
Acked-by Jiri Olsa <[email protected]>jirka
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
PeterZ,
Can I have your Acked-by for this one? I guess now the goal is
achieved, no?
- Arnaldo
Em Tue, Nov 05, 2013 at 11:25:45AM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 28 lines
Em Tue, Nov 05, 2013 at 02:30:24PM +0100, Jiri Olsa escreveu:
Quoted 9 lines · Adrian Hunter
Quoted 8 lines
Quoted 3 lines
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
How about this:
From: Adrian Hunter <[email protected]>
Quoted 7 lines
Quoted 5 lines
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>seems ok, thanks
Much better, but may I ask that the explanation in the man pages be present in the changeset commit as well? So that by just looking at 'git log' we can more readily get the whole picture, i.e. scalability versus wanting to have inherit.
- Arnaldo
Quoted 3 lines
Acked-by Jiri Olsa <[email protected]>jirka
Adrian Hunter
reviewerRe: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Quoted 4 lines · Arnaldo Carvalho de Melo
PeterZ,
Can I have your Acked-by for this one? I guess now the goal is
achieved, no?
Ping
Quoted 30 lines
- Arnaldo
Em Tue, Nov 05, 2013 at 11:25:45AM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 25 lines
Em Tue, Nov 05, 2013 at 02:30:24PM +0100, Jiri Olsa escreveu:
Quoted 6 lines · Adrian Hunter
Quoted 5 lines
Quoted 3 lines
right, I haven't considered the hundreds CPU machine.. I just saw that it disables inherited events in my test ;-) maybe we could mentioned that somewhere, because it's not clear
How about this:
Quoted 8 lines
Quoted 7 lines
From: Adrian Hunter <[email protected]>
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created. Add an option to override that and force per-cpu mmaps.
Signed-off-by Adrian Hunter <[email protected]>seems ok, thanks
Much better, but may I ask that the explanation in the man pages be present in the changeset commit as well? So that by just looking at 'git log' we can more readily get the whole picture, i.e. scalability versus wanting to have inherit.
- Arnaldo
Quoted 3 lines
Acked-by Jiri Olsa <[email protected]>jirka
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
In reply to Arnaldo Carvalho de MeloQuoted 4 lines · Arnaldo Carvalho de Melo
PeterZ,
Can I have your Acked-by for this one? I guess now the goal is
achieved, no?
So this option allows -t/-p/-u to create one buffer per cpu and attach all the various thread/process/user tasks' their counters to that one buffer?
As opposed to the current state where each such counter would have its own buffer.
If this is what the patch does, then yes, although I would prefer a slightly clearer Changelog.
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Em Fri, Nov 08, 2013 at 09:40:01AM +0100, Peter Zijlstra escreveu:
Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 2 lines
Can I have your Acked-by for this one? I guess now the goal is
achieved, no?So this option allows -t/-p/-u to create one buffer per cpu and attach all the various thread/process/user tasks' their counters to that one buffer?
Quoted 5 lines
As opposed to the current state where each such counter would have its own buffer.
If this is what the patch does, then yes, although I would prefer a slightly clearer Changelog.
/me too
I will re-read the patch to check that it matches what you think it does and will update the changelog to make it clearer.
Quoted 1 line
Acked-by Peter Zijlstra <[email protected]>
Thanks!
- Arnaldo
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
In reply to Peter ZijlstraQuoted 10 lines · Peter Zijlstra
Quoted 4 lines · Arnaldo Carvalho de Melo
PeterZ,
Can I have your Acked-by for this one? I guess now the goal is
achieved, no?So this option allows -t/-p/-u to create one buffer per cpu and attach all the various thread/process/user tasks' their counters to that one buffer?
Quoted 7 lines
As opposed to the current state where each such counter would have its own buffer.
If this is what the patch does, then yes, although I would prefer a slightly clearer Changelog.
Acked-by Peter Zijlstra <[email protected]>
Is there any reason why we wouldn't want to make this the default behavior?
That way we could also lose the somewhat suboptimal 'force' naming:
there's nothing forced really, we simply switch to another ring-buffer setup ...
Thanks,
Ingo
Re: [PATCH V3 06/11] perf record: Add an option to force per-cpu mmaps
Ingo Molnar [[email protected]] wrote:
| | * Peter Zijlstra <[email protected]> wrote: | | > On Tue, Nov 05, 2013 at 02:31:52PM -0300, Arnaldo Carvalho de Melo wrote: | > > PeterZ, | > > | > > Can I have your Acked-by for this one? I guess now the goal is | > > achieved, no?
Being able to profile children with the --pid is a big plus.
| > | > So this option allows -t/-p/-u to create one buffer per cpu and attach | > all the various thread/process/user tasks' their counters to that one | > buffer? | > | > As opposed to the current state where each such counter would have its | > own buffer. | > | > If this is what the patch does, then yes, although I would prefer a | > slightly clearer Changelog. | > | > Acked-by: Peter Zijlstra <[email protected]> | | Is there any reason why we wouldn't want to make this the default | behavior? | | That way we could also lose the somewhat suboptimal 'force' naming: | there's nothing forced really, we simply switch to another ring-buffer | setup ...
It would be also good if the man page added a comment on when a user would want one ring-buffer setup over the other.
If the main benefit is to have the children profiled when tasks are specified, how about changing the option to --inherit (-I) ?
Or for consistency with 'perf record <application>', have --pid profile children by default and let users specify --no-inherit with --pid if they don't want children profiled.
Sukadev
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf record: Add an option to force per-cpu mmaps
In reply to Adrian Hunterperf record: Add an option to force per-cpu mmaps
Commit-ID: 539e6bb71e350541105e67e3d6c31392d9da25ef Gitweb: http://git.kernel.org/tip/539e6bb71e350541105e67e3d6c31392d9da25ef Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:34 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 14 Nov 2013 16:10:27 -0300
perf record: Add an option to force per-cpu mmaps
By default, when tasks are specified (i.e. -p, -t or -u options) per-thread mmaps are created.
Add an option to override that and force per-cpu mmaps.
Further comments by peterz:
So this option allows -t/-p/-u to create one buffer per cpu and attach all the various thread/process/user tasks' their counters to that one buffer?
As opposed to the current state where each such counter would have its own buffer.
--- tools/perf/Documentation/perf-record.txt | 6 ++++++ tools/perf/builtin-record.c | 2 ++ tools/perf/util/evlist.c | 4 +++- tools/perf/util/evsel.c | 4 ++-- tools/perf/util/target.h | 1 + 5 files changed, 14 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-record.txt +6 -0
@@ -201,6 +201,12 @@ abort events and some memory events in precise mode on modern Intel CPUs. --transaction:: Record transaction flags for transaction related events. +--force-per-cpu:: +Force the use of per-cpu mmaps. By default, when tasks are specified (i.e. -p, +-t or -u options) per-thread mmaps are created. This option overrides that and +forces per-cpu mmaps. A side-effect of that is that inheritance is +automatically enabled. Add the -i option also to disable inheritance. + SEE ALSO -------- linkperf:perf-stat[1], linkperf:perf-list[1]
tools/perf/builtin-record.c +2 -0
@@ -888,6 +888,8 @@ const struct option record_options[] = { "sample by weight (on special events only)"),OPT_BOOLEAN (0 ,"transaction" , &record.opts.sample_transaction,"sample transaction flags (special events only)" ), +OPT_BOOLEAN (0 ,"force-per-cpu" , &record.opts.target.force_per_cpu, +"force the use of per-cpu mmaps" ), OPT_END() };
tools/perf/util/evlist.c +3 -1
@@ -819,7 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)if (evlist->threads ==NULL )return -1 ; -if (target__has_task (target)) +if (target->force_per_cpu) + evlist->cpus =cpu_map__new (target->cpu_list); +else if (target__has_task (target)) evlist->cpus =cpu_map__dummy_new ();else if (!target__has_cpu (target) && !target->uses_mmap) evlist->cpus =cpu_map__dummy_new ();
tools/perf/util/evsel.c +2 -2
@@ -645,7 +645,7 @@ void perf_evsel__config(struct perf_evsel *evsel, } } -if (target__has_cpu (&opts->target)) +if (target__has_cpu (&opts->target) || opts->target.force_per_cpu)perf_evsel__set_sample_bit (evsel,CPU );if (opts->period)
@@ -653,7 +653,7 @@ void perf_evsel__config(struct perf_evsel *evsel,if (!perf_missing_features.sample_id_all && (opts->sample_time || !opts->no_inherit || -target__has_cpu (&opts->target))) +target__has_cpu (&opts->target) || opts->target.force_per_cpu))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples) {
tools/perf/util/target.h +1 -0
@@ -12,6 +12,7 @@ struct target {uid_t uid;bool system_wide;bool uses_mmap; +bool force_per_cpu; };enum target_errno {
Adrian Hunter
reviewerPATCH v3 7/11 perf evsel: Always use perf_evsel__set_sample_bit()
In reply to Adrian HunterAlways use perf_evsel__set_sample_bit() rather than just setting the bit.
--- tools/perf/util/evsel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/evsel.c +3 -3
@@ -663,7 +663,7 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_address) - attr->sample_type |=PERF_SAMPLE_DATA_SRC ; +perf_evsel__set_sample_bit (evsel,DATA_SRC );if (opts->no_delay) { attr->watermark =0 ;
@@ -675,14 +675,14 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_weight) - attr->sample_type |=PERF_SAMPLE_WEIGHT ; +perf_evsel__set_sample_bit (evsel,WEIGHT ); attr->mmap = track; attr->mmap2 = track && !perf_missing_features.mmap2; attr->comm = track;if (opts->sample_transaction) - attr->sample_type |=PERF_SAMPLE_TRANSACTION ; +perf_evsel__set_sample_bit (evsel,TRANSACTION );/* * XXX see the function comment above
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf evsel: Always use perf_evsel__set_sample_bit ()
perf evsel: Always use perf_evsel__set_sample_bit()
Commit-ID: 1e7ed5ec54e3998bda6ea625599a0644404cb421 Gitweb: http://git.kernel.org/tip/1e7ed5ec54e3998bda6ea625599a0644404cb421 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:35 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:42:28 -0300
perf evsel: Always use perf_evsel__set_sample_bit()
Always use perf_evsel__set_sample_bit() rather than just setting the bit.
--- tools/perf/util/evsel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/util/evsel.c +3 -3
@@ -663,7 +663,7 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_address) - attr->sample_type |=PERF_SAMPLE_DATA_SRC ; +perf_evsel__set_sample_bit (evsel,DATA_SRC );if (opts->no_delay) { attr->watermark =0 ;
@@ -675,13 +675,13 @@ void perf_evsel__config(struct perf_evsel *evsel, }if (opts->sample_weight) - attr->sample_type |=PERF_SAMPLE_WEIGHT ; +perf_evsel__set_sample_bit (evsel,WEIGHT ); attr->mmap = track; attr->comm = track;if (opts->sample_transaction) - attr->sample_type |=PERF_SAMPLE_TRANSACTION ; +perf_evsel__set_sample_bit (evsel,TRANSACTION );/* * XXX see the function comment above
Adrian Hunter
reviewerPATCH v3 8/11 perf evsel: Add missing overflow check
In reply to Adrian HunterAdd missing overflow check inperf_evsel__parse_sample()
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1482,6 +1482,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, data->transaction =0 ;if (type &PERF_SAMPLE_TRANSACTION ) { +OVERFLOW_CHECK_u64 (array); data->transaction = *array; array++; }
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf evsel: Add missing overflow check for TRANSACTION
perf evsel: Add missing overflow check for TRANSACTION
Commit-ID: 87b955247d71975460774435241be3aa05218a7b Gitweb: http://git.kernel.org/tip/87b955247d71975460774435241be3aa05218a7b Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:36 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:44:01 -0300
perf evsel: Add missing overflow check for TRANSACTION
Add missing overflow check for PERF_SAMPLE_TRANSACTION in perf_evsel__parse_sample().
--- tools/perf/util/evsel.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/evsel.c +1 -0
@@ -1481,6 +1481,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, data->transaction =0 ;if (type &PERF_SAMPLE_TRANSACTION ) { +OVERFLOW_CHECK_u64 (array); data->transaction = *array; array++; }
Adrian Hunter
reviewerPATCH v3 9/11 perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
In reply to Adrian HunterIn fact the "sample parsing" test does not automatically check new sample type bits - they must be added to the comparison logic. Doing that shows that the test fails because the functions perf_event__synthesize_sample() and perf_event__sample_event_size() have not been updated with PERF_SAMPLE_TRANSACTION either.
--- tools/perf/tests/sample-parsing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/tests/sample-parsing.c +6 -1
@@ -121,6 +121,9 @@ static bool samples_same(const struct perf_sample *s1,if (type &PERF_SAMPLE_DATA_SRC )COMP (data_src); +if (type &PERF_SAMPLE_TRANSACTION ) +COMP (transaction); +return true; }
@@ -165,6 +168,7 @@ static int do_test(u64 sample_type, u64 sample_regs_user, u64 read_format) .cpu = 110, .raw_size = sizeof(raw_data), .data_src = 111, + .transaction = 112, .raw_data = (void *)raw_data, .callchain = &callchain.callchain, .branch_stack = &branch_stack.branch_stack,
@@ -273,7 +277,8 @@ int test__sample_parsing(void)/* * Fail the test if it has not been updated when new sample format bits -* were added. +* were added. Please actually update the test rather than just change +* the condition below. */ if (PERF_SAMPLE_MAX >PERF_SAMPLE_TRANSACTION <<1 ) {pr_debug ("sample format has changed, some new PERF_SAMPLE_ bit was introduced - test needs updating\n" );
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
Commit-ID: 091a4ef5a94d46d26a05f0c32d2f64800ed91306 Gitweb: http://git.kernel.org/tip/091a4ef5a94d46d26a05f0c32d2f64800ed91306 Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:37 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:47:24 -0300
perf test: Update "sample parsing" test for PERF_SAMPLE_TRANSACTION
In fact the "sample parsing" test does not automatically check new sample type bits - they must be added to the comparison logic.
Doing that shows that the test fails because the functions perf_event__synthesize_sample() and perf_event__sample_event_size() have not been updated with PERF_SAMPLE_TRANSACTION either.
--- tools/perf/tests/sample-parsing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/tests/sample-parsing.c +6 -1
@@ -121,6 +121,9 @@ static bool samples_same(const struct perf_sample *s1,if (type &PERF_SAMPLE_DATA_SRC )COMP (data_src); +if (type &PERF_SAMPLE_TRANSACTION ) +COMP (transaction); +return true; }
@@ -165,6 +168,7 @@ static int do_test(u64 sample_type, u64 sample_regs_user, u64 read_format) .cpu = 110, .raw_size = sizeof(raw_data), .data_src = 111, + .transaction = 112, .raw_data = (void *)raw_data, .callchain = &callchain.callchain, .branch_stack = &branch_stack.branch_stack,
@@ -273,7 +277,8 @@ int test__sample_parsing(void)/* * Fail the test if it has not been updated when new sample format bits -* were added. +* were added. Please actually update the test rather than just change +* the condition below. */ if (PERF_SAMPLE_MAX >PERF_SAMPLE_TRANSACTION <<1 ) {pr_debug ("sample format has changed, some new PERF_SAMPLE_ bit was introduced - test needs updating\n" );
Adrian Hunter
reviewerPATCH v3 10/11 perf evsel: Add missing PERF_SAMPLE_TRANSACTION
In reply to Adrian HunterAdd missing PERF_SAMPLE_TRANSACTION toperf_event__synthesize_sample() andperf_event__sample_event_size().
This makes the "sample parsing" test pass.
--- tools/perf/util/evsel.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/evsel.c +8 -0
@@ -1579,6 +1579,9 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,if (type &PERF_SAMPLE_DATA_SRC ) result +=sizeof (u64); +if (type &PERF_SAMPLE_TRANSACTION ) + result +=sizeof (u64); +return result; }
@@ -1752,6 +1755,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, array++; } +if (type &PERF_SAMPLE_TRANSACTION ) { + *array = sample->transaction; + array++; + } +return 0 ; }
Signature · 1 line
1.7.11.7
tip-bot for Adrian Hunter
merge bot[tip:perf/core] perf evsel: Synthesize PERF_SAMPLE_TRANSACTION
perf evsel: Synthesize PERF_SAMPLE_TRANSACTION
Commit-ID: 42d88910c717ba21089251d0ca559abfef0df22d Gitweb: http://git.kernel.org/tip/42d88910c717ba21089251d0ca559abfef0df22d Author: Adrian Hunter <[email protected]> AuthorDate: Fri, 1 Nov 2013 15:51:38 +0200 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 4 Nov 2013 12:49:36 -0300
perf evsel: Synthesize PERF_SAMPLE_TRANSACTION
Add missing PERF_SAMPLE_TRANSACTION to perf_event__synthesize_sample() and perf_event__sample_event_size().
This makes the "sample parsing" test pass.
--- tools/perf/util/evsel.c | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/util/evsel.c +8 -0
@@ -1578,6 +1578,9 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,if (type &PERF_SAMPLE_DATA_SRC ) result +=sizeof (u64); +if (type &PERF_SAMPLE_TRANSACTION ) + result +=sizeof (u64); +return result; }
@@ -1751,6 +1754,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, array++; } +if (type &PERF_SAMPLE_TRANSACTION ) { + *array = sample->transaction; + array++; + } +return 0 ; }
Adrian Hunter
reviewerPATCH v3 11/11 perf tools: Allow non-matching sample types
In reply to Adrian HunterFor kernels that do not support PERF_SAMPLE_IDENTIFIER, sample types need not be identical to determine the sample id from the event. Only the position of the sample id needs to be the same.
Compatible sample types are ones in which the bits defined by PERF_COMPAT_MASK are the same. 'perf_evlist__config()' forces sample types to be compatible on that basis.
--- tools/perf/builtin-trace.c | 1 + tools/perf/perf.h | 1 + tools/perf/util/event.h | 16 ++++++++++++++++ tools/perf/util/evlist.c | 25 +++++++++++++++++++++++++ tools/perf/util/evlist.h | 1 + tools/perf/util/record.c | 5 ++++- 6 files changed, 48 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -0
@@ -2062,6 +2062,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) .user_interval = ULLONG_MAX, .no_delay = true, .mmap_pages = 1024, + .incompatible_sample_types = true, }, .output = stdout, .show_comm = true,
tools/perf/perf.h +1 -0
@@ -233,6 +233,7 @@ struct perf_record_opts {u64 user_interval;u16 stack_dump_size;bool sample_transaction; + bool incompatible_sample_types; };#endif
tools/perf/util/event.h +16 -0
@@ -78,6 +78,22 @@ struct throttle_event {/* perf sample has 16 bits size limit */ #define PERF_SAMPLE_MAX_SIZE (1 << 16) +/* +* Events have compatible sample types if the following bits all have the same +* value. This is because the order of sample members is fixed. For sample +* events the order is: PERF_SAMPLE_IP, PERF_SAMPLE_TID, PERF_SAMPLE_TIME, +* PERF_SAMPLE_ADDR, PERF_SAMPLE_ID. For non-sample events the sample members +* are accessed in reverse order. The order is: PERF_SAMPLE_ID, +* PERF_SAMPLE_STREAM_ID, PERF_SAMPLE_CPU. PERF_SAMPLE_IDENTIFIER is added for +* completeness but it should not be used with PERF_SAMPLE_ID. Sample types +* that include PERF_SAMPLE_IDENTIFIER are always compatible. +*/ +#define PERF_COMPAT_MASK \ + (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ + PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ + PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \ + PERF_SAMPLE_CPU | PERF_SAMPLE_IDENTIFIER) +struct sample_event {struct perf_event_header header;u64 array[];
tools/perf/util/evlist.c +25 -0
@@ -87,6 +87,31 @@ static void perf_evlist__update_id_pos(struct perf_evlist *evlist)perf_evlist__set_id_pos (evlist); } +/** +* perf_evlist__make_sample_types_compatible - make sample types compatible. +* @evlist: selected event list +* +* Events with compatible sample types all have the same id_pos and is_pos. +* This can be achieved by matching the bits of PERF_COMPAT_MASK. +*/ +void perf_evlist__make_sample_types_compatible (struct perf_evlist *evlist) +{ +struct perf_evsel *evsel; +u64 compat =0 ; + +list_for_each_entry (evsel, &evlist->entries, node) + compat |= evsel->attr.sample_type &PERF_COMPAT_MASK ; + +list_for_each_entry (evsel, &evlist->entries, node) { + evsel->attr.sample_type |= compat; + evsel->sample_size = +__perf_evsel__sample_size (evsel->attr.sample_type); +perf_evsel__calc_id_pos (evsel); + } + +perf_evlist__set_id_pos (evlist); +} +static void perf_evlist__purge (struct perf_evlist *evlist) {struct perf_evsel *pos, *n;
tools/perf/util/evlist.h +1 -0
@@ -96,6 +96,7 @@ int perf_evlist__open(struct perf_evlist *evlist);void perf_evlist__close (struct perf_evlist *evlist);void perf_evlist__set_id_pos (struct perf_evlist *evlist); +void perf_evlist__make_sample_types_compatible (struct perf_evlist *evlist);bool perf_can_sample_identifier (void );void perf_evlist__config (struct perf_evlist *evlist,struct perf_record_opts *opts);
tools/perf/util/record.c +4 -1
@@ -104,5 +104,8 @@ void perf_evlist__config(struct perf_evlist *evlist,perf_evsel__set_sample_id (evsel, use_sample_identifier); } -perf_evlist__set_id_pos (evlist); +if (use_sample_identifier || opts->incompatible_sample_types) +perf_evlist__set_id_pos (evlist); +else +perf_evlist__make_sample_types_compatible (evlist); }
Signature · 1 line
1.7.11.7