Merge tag 'perf-core-for-mingo-4.12-20170413' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes Arnaldo Carvalho de Melo: User visible changes: - Fix 'perf stat' bug in handling events in error state (Stephane Eranian) Documentation changes: - Add usage of --no-syscalls in 'perf trace' man page (Ravi Bangoria) Infrastructure changes: - Pass PYTHON config to feature detection (David Carrillo-Cisneros) - Disable JVMTI if no ELF support available (David Carrillo-Cisneros) - Fix feature detection redefinion of build flags (David Carrillo-Cisneros) - Hint missing file when tool tips fail to load (David Carrillo-Cisneros) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -53,17 +53,17 @@ FILES= \
|
|||||||
|
|
||||||
FILES := $(addprefix $(OUTPUT),$(FILES))
|
FILES := $(addprefix $(OUTPUT),$(FILES))
|
||||||
|
|
||||||
CC ?= $(CROSS_COMPILE)gcc -MD
|
CC ?= $(CROSS_COMPILE)gcc
|
||||||
CXX ?= $(CROSS_COMPILE)g++ -MD
|
CXX ?= $(CROSS_COMPILE)g++
|
||||||
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
|
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
|
||||||
LLVM_CONFIG ?= llvm-config
|
LLVM_CONFIG ?= llvm-config
|
||||||
|
|
||||||
all: $(FILES)
|
all: $(FILES)
|
||||||
|
|
||||||
__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
|
__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
|
||||||
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
|
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
|
||||||
|
|
||||||
__BUILDXX = $(CXX) $(CXXFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
|
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
|
||||||
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
|
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin:
|
|||||||
$(BUILD) $(FLAGS_PERL_EMBED)
|
$(BUILD) $(FLAGS_PERL_EMBED)
|
||||||
|
|
||||||
$(OUTPUT)test-libpython.bin:
|
$(OUTPUT)test-libpython.bin:
|
||||||
$(BUILD)
|
$(BUILD) $(FLAGS_PYTHON_EMBED)
|
||||||
|
|
||||||
$(OUTPUT)test-libpython-version.bin:
|
$(OUTPUT)test-libpython-version.bin:
|
||||||
$(BUILD)
|
$(BUILD)
|
||||||
|
@@ -123,7 +123,8 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
|
|||||||
major or all pagefaults. Default value is maj.
|
major or all pagefaults. Default value is maj.
|
||||||
|
|
||||||
--syscalls::
|
--syscalls::
|
||||||
Trace system calls. This options is enabled by default.
|
Trace system calls. This options is enabled by default, disable with
|
||||||
|
--no-syscalls.
|
||||||
|
|
||||||
--call-graph [mode,type,min[,limit],order[,key][,branch]]::
|
--call-graph [mode,type,min[,limit],order[,key][,branch]]::
|
||||||
Setup and enable call-graph (stack chain/backtrace) recording.
|
Setup and enable call-graph (stack chain/backtrace) recording.
|
||||||
|
@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
|
|||||||
override PYTHON_CONFIG := \
|
override PYTHON_CONFIG := \
|
||||||
$(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
|
$(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
|
||||||
|
|
||||||
|
grep-libs = $(filter -l%,$(1))
|
||||||
|
strip-libs = $(filter-out -l%,$(1))
|
||||||
|
|
||||||
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
|
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
|
||||||
|
|
||||||
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
|
ifdef PYTHON_CONFIG
|
||||||
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
|
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
|
||||||
|
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
|
||||||
ifeq ($(CC), clang)
|
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
|
||||||
|
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
|
||||||
|
ifeq ($(CC), clang)
|
||||||
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
|
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
|
||||||
|
endif
|
||||||
|
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
|
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
|
||||||
@@ -267,6 +274,7 @@ ifdef NO_LIBELF
|
|||||||
NO_LIBUNWIND := 1
|
NO_LIBUNWIND := 1
|
||||||
NO_LIBDW_DWARF_UNWIND := 1
|
NO_LIBDW_DWARF_UNWIND := 1
|
||||||
NO_LIBBPF := 1
|
NO_LIBBPF := 1
|
||||||
|
NO_JVMTI := 1
|
||||||
else
|
else
|
||||||
ifeq ($(feature-libelf), 0)
|
ifeq ($(feature-libelf), 0)
|
||||||
ifeq ($(feature-glibc), 1)
|
ifeq ($(feature-glibc), 1)
|
||||||
@@ -276,7 +284,7 @@ else
|
|||||||
LIBC_SUPPORT := 1
|
LIBC_SUPPORT := 1
|
||||||
endif
|
endif
|
||||||
ifeq ($(LIBC_SUPPORT),1)
|
ifeq ($(LIBC_SUPPORT),1)
|
||||||
msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel);
|
msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
|
||||||
|
|
||||||
NO_LIBELF := 1
|
NO_LIBELF := 1
|
||||||
NO_DWARF := 1
|
NO_DWARF := 1
|
||||||
@@ -284,6 +292,7 @@ else
|
|||||||
NO_LIBUNWIND := 1
|
NO_LIBUNWIND := 1
|
||||||
NO_LIBDW_DWARF_UNWIND := 1
|
NO_LIBDW_DWARF_UNWIND := 1
|
||||||
NO_LIBBPF := 1
|
NO_LIBBPF := 1
|
||||||
|
NO_JVMTI := 1
|
||||||
else
|
else
|
||||||
ifneq ($(filter s% -static%,$(LDFLAGS),),)
|
ifneq ($(filter s% -static%,$(LDFLAGS),),)
|
||||||
msg := $(error No static glibc found, please install glibc-static);
|
msg := $(error No static glibc found, please install glibc-static);
|
||||||
@@ -554,8 +563,6 @@ ifndef NO_GTK2
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grep-libs = $(filter -l%,$(1))
|
|
||||||
strip-libs = $(filter-out -l%,$(1))
|
|
||||||
|
|
||||||
ifdef NO_LIBPERL
|
ifdef NO_LIBPERL
|
||||||
CFLAGS += -DNO_LIBPERL
|
CFLAGS += -DNO_LIBPERL
|
||||||
@@ -603,21 +610,9 @@ else
|
|||||||
$(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
|
$(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
|
||||||
else
|
else
|
||||||
|
|
||||||
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
|
|
||||||
|
|
||||||
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
|
|
||||||
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
|
|
||||||
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
|
|
||||||
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
|
|
||||||
ifeq ($(CC), clang)
|
|
||||||
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
|
|
||||||
endif
|
|
||||||
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
|
|
||||||
|
|
||||||
ifneq ($(feature-libpython), 1)
|
ifneq ($(feature-libpython), 1)
|
||||||
$(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
|
$(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
|
||||||
else
|
else
|
||||||
|
|
||||||
ifneq ($(feature-libpython-version), 1)
|
ifneq ($(feature-libpython-version), 1)
|
||||||
$(warning Python 3 is not yet supported; please set)
|
$(warning Python 3 is not yet supported; please set)
|
||||||
$(warning PYTHON and/or PYTHON_CONFIG appropriately.)
|
$(warning PYTHON and/or PYTHON_CONFIG appropriately.)
|
||||||
|
@@ -312,8 +312,12 @@ static int read_counter(struct perf_evsel *counter)
|
|||||||
struct perf_counts_values *count;
|
struct perf_counts_values *count;
|
||||||
|
|
||||||
count = perf_counts(counter->counts, cpu, thread);
|
count = perf_counts(counter->counts, cpu, thread);
|
||||||
if (perf_evsel__read(counter, cpu, thread, count))
|
if (perf_evsel__read(counter, cpu, thread, count)) {
|
||||||
|
counter->counts->scaled = -1;
|
||||||
|
perf_counts(counter->counts, cpu, thread)->ena = 0;
|
||||||
|
perf_counts(counter->counts, cpu, thread)->run = 0;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (STAT_RECORD) {
|
if (STAT_RECORD) {
|
||||||
if (perf_evsel__write_stat_event(counter, cpu, thread, count)) {
|
if (perf_evsel__write_stat_event(counter, cpu, thread, count)) {
|
||||||
@@ -338,12 +342,14 @@ static int read_counter(struct perf_evsel *counter)
|
|||||||
static void read_counters(void)
|
static void read_counters(void)
|
||||||
{
|
{
|
||||||
struct perf_evsel *counter;
|
struct perf_evsel *counter;
|
||||||
|
int ret;
|
||||||
|
|
||||||
evlist__for_each_entry(evsel_list, counter) {
|
evlist__for_each_entry(evsel_list, counter) {
|
||||||
if (read_counter(counter))
|
ret = read_counter(counter);
|
||||||
|
if (ret)
|
||||||
pr_debug("failed to read counter %s\n", counter->name);
|
pr_debug("failed to read counter %s\n", counter->name);
|
||||||
|
|
||||||
if (perf_stat_process_counter(&stat_config, counter))
|
if (ret == 0 && perf_stat_process_counter(&stat_config, counter))
|
||||||
pr_warning("failed to process counter %s\n", counter->name);
|
pr_warning("failed to process counter %s\n", counter->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
|
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
|
||||||
#include <api/fs/fs.h>
|
#include <api/fs/fs.h>
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@@ -1239,7 +1239,7 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
|
|||||||
if (FD(evsel, cpu, thread) < 0)
|
if (FD(evsel, cpu, thread) < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) < 0)
|
if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) <= 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1257,7 +1257,7 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
|
|||||||
if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
|
if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0)
|
if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
perf_evsel__compute_deltas(evsel, cpu, thread, &count);
|
perf_evsel__compute_deltas(evsel, cpu, thread, &count);
|
||||||
|
@@ -696,7 +696,8 @@ const char *perf_tip(const char *dirpath)
|
|||||||
|
|
||||||
tips = strlist__new("tips.txt", &conf);
|
tips = strlist__new("tips.txt", &conf);
|
||||||
if (tips == NULL)
|
if (tips == NULL)
|
||||||
return errno == ENOENT ? NULL : "Tip: get more memory! ;-p";
|
return errno == ENOENT ? NULL :
|
||||||
|
"Tip: check path of tips.txt or get more memory! ;-p";
|
||||||
|
|
||||||
if (strlist__nr_entries(tips) == 0)
|
if (strlist__nr_entries(tips) == 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
Reference in New Issue
Block a user