Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

User visible changes:

  - Fix perf.data size reporting in 'perf record' in no-buildid mode (He Kuang)

Infrastructure changes:

  - Protect accesses the DSO rbtrees/lists with a rw lock and reference
    count struct dso instances (Arnaldo Carvalho de Melo)

  - Export dynamic symbols used by traceevent plugins (He Kuang)

  - Add libtrace-dynamic-list file to libtraceevent's .gitignore (He Kuang)

  - Refactor shadow stats code in 'perf stat', prep work for further
    patchkits (Jiri Olsa)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Jun 9, 2015
2 parents a3d8654 + d3a7c48 commit 028c63b
Show file tree
Hide file tree
Showing 22 changed files with 737 additions and 573 deletions.
1 change: 1 addition & 0 deletions tools/lib/traceevent/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
TRACEEVENT-CFLAGS
libtraceevent-dynamic-list
14 changes: 13 additions & 1 deletion tools/lib/traceevent/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endef
# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
$(call allow-override,AR,$(CROSS_COMPILE)ar)
$(call allow-override,NM,$(CROSS_COMPILE)nm)

EXT = -std=gnu99
INSTALL = install
Expand Down Expand Up @@ -157,8 +158,9 @@ PLUGINS_IN := $(PLUGINS:.so=-in.o)

TE_IN := $(OUTPUT)libtraceevent-in.o
LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list

CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
CMD_TARGETS = $(LIB_FILE) $(PLUGINS) $(DYNAMIC_LIST_FILE)

TARGETS = $(CMD_TARGETS)

Expand All @@ -175,6 +177,9 @@ $(OUTPUT)libtraceevent.so: $(TE_IN)
$(OUTPUT)libtraceevent.a: $(TE_IN)
$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^

$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)

plugins: $(PLUGINS)

__plugin_obj = $(notdir $@)
Expand Down Expand Up @@ -244,6 +249,13 @@ define do_install_plugins
done
endef

define do_generate_dynamic_list_file
(echo '{'; \
$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u; \
echo '};'; \
) > $2
endef

install_lib: all_cmd install_plugins
$(call QUIET_INSTALL, $(LIB_FILE)) \
$(call do_install,$(LIB_FILE),$(libdir_SQ))
Expand Down
14 changes: 12 additions & 2 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ endif
LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
export LIBTRACEEVENT

LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
LDFLAGS += -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)

LIBAPI = $(LIB_PATH)libapi.a
export LIBAPI

Expand Down Expand Up @@ -278,7 +281,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
$(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
$(Q)$(MAKE) $(build)=perf

$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@

$(GTK_IN): FORCE
Expand Down Expand Up @@ -373,7 +376,13 @@ $(LIB_FILE): $(LIBPERF_IN)
LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)

$(LIBTRACEEVENT): FORCE
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a

libtraceevent_plugins: FORCE
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins

$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list

$(LIBTRACEEVENT)-clean:
$(call QUIET_CLEAN, libtraceevent)
Expand Down Expand Up @@ -555,4 +564,5 @@ FORCE:
.PHONY: all install clean config-clean strip install-gtk
.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
.PHONY: libtraceevent_plugins

6 changes: 2 additions & 4 deletions tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,9 @@ static int process_buildids(struct record *rec)
struct perf_data_file *file = &rec->file;
struct perf_session *session = rec->session;

u64 size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);
if (size == 0)
if (file->size == 0)
return 0;

file->size = size;

/*
* During this process, it'll load kernel map and replace the
* dso->long_name to a real pathname it found. In this case
Expand Down Expand Up @@ -719,6 +716,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)

if (!err && !file->is_pipe) {
rec->session->header.data_size += rec->bytes_written;
file->size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);

if (!rec->no_buildid) {
process_buildids(rec);
Expand Down
Loading

0 comments on commit 028c63b

Please sign in to comment.