Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339254

[PATCH 28/48] perf record: Disable buildid cache options by default in switch output mode

From Wang Nan <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 28/48] perf record: Disable buildid cache options by default in switch output mode
Date 2016-02-22 10:20 +0100
Message-ID <r4UOT-3pt-39@gated-at.bofh.it> (permalink)
References <r4UOR-3pt-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Cost of buildid cache processing is high: read all events in output
perf.data, open elf files to read buildid then copy them into
~/.debug directory. In switch output mode, causes perf stop receiving
from perf events for too long.

Enable no-buildid and no-buildid-cache by default if --switch-output
is provided. Still allow user use --no-no-buildid to explicitly enable
buildid in this case.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---
 tools/perf/builtin-record.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 8987ce8..2839715 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1383,8 +1383,36 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 "If some relocation was applied (e.g. kexec) symbols may be misresolved\n"
 "even with a suitable vmlinux or kallsyms file.\n\n");
 
-	if (rec->no_buildid_cache || rec->no_buildid)
+	if (rec->no_buildid_cache || rec->no_buildid) {
 		disable_buildid_cache();
+	} else if (rec->switch_output) {
+		/*
+		 * In 'perf record --switch-output', disable buildid
+		 * generation by default to reduce data file switching
+		 * overhead. Still generate buildid if they are required
+		 * explicitly using
+		 *
+		 *  perf record --signal-trigger --no-no-buildid \
+		 *              --no-no-buildid-cache
+		 *
+		 * Following code equals to:
+		 *
+		 * if ((rec->no_buildid || !rec->no_buildid_set) &&
+		 *     (rec->no_buildid_cache || !rec->no_buildid_cache_set))
+		 *         disable_buildid_cache();
+		 */
+		bool disable = true;
+
+		if (rec->no_buildid_set && !rec->no_buildid)
+			disable = false;
+		if (rec->no_buildid_cache_set && !rec->no_buildid_cache)
+			disable = false;
+		if (disable) {
+			rec->no_buildid = true;
+			rec->no_buildid_cache = true;
+			disable_buildid_cache();
+		}
+	}
 
 	if (rec->evlist->nr_entries == 0 &&
 	    perf_evlist__add_default(rec->evlist) < 0) {
-- 
1.8.3.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/48] perf tools: Bugfix, BPF improvements and overwrite ring buffer support Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 15/48] perf core: Prepare writing into ring buffer from end Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 28/48] perf record: Disable buildid cache options by default in switch output mode Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 09/48] perf tools: Pass tracepoint options to BPF script Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 27/48] perf record: Force enable --timestamp-filename when --switch-output is provided Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 31/48] perf record: Ensure return non-zero rc when mmap fail Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 19/48] perf tools: Print write_backward value in perf_event_attr__fprintf Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 40/48] perf tools: Enable overwrite settings Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:20 +0100
  [PATCH 22/48] perf tools: Add perf_data_file__switch() helper Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 25/48] perf record: Add '--timestamp-filename' option to append timestamp to output filename Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 18/48] perf tools: Only validate is_pos for tracking evsels Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 17/48] perf core: Reduce perf event output overhead by new overflow handler Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 39/48] perf tools: Detect avalibility of write_backward Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 02/48] perf tools: Adjust symbol for shared objects Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 34/48] perf tools: Automatically add new channel according to evlist Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 43/48] perf tools: Add API to pause a channel Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 04/48] perf tools: Enable BPF object configure syntax Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 44/48] perf record: Toggle overwrite ring buffer for reading Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 32/48] perf record: Prevent reading invalid data in record__mmap_read Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 21/48] perf record: Extract synthesize code to record__synthesize() Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 11/48] perf data: Support converting data from bpf_perf_event_output() Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:30 +0100
  [PATCH 05/48] perf record: Apply config to BPF objects before recording Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 01/48] perf tools: Record text offset in dso to calculate objdump address Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 24/48] perf record: Introduce record__finish_output() to finish a perf.data Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 07/48] perf tools: Support setting different slots in a BPF map separately Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 47/48] perf record: Allow generate tracking events at the end of output Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 38/48] perf record: Don't poll on overwrite channel Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 48/48] perf tools: Don't warn about out of order event if write_backward is used Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 06/48] perf tools: Enable passing event to BPF object Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 42/48] perf tools: Record fd into perf_mmap Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 20/48] perf tools: Make ordered_events reusable Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 16/48] perf core: Add backward attribute to perf event Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 29/48] perf record: Re-synthesize tracking events after output switching Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 12/48] perf data: Explicitly set byte order for integer types Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100
  [PATCH 03/48] perf bpf: Add API to set values to map entries in a bpf object Wang Nan <wangnan0@huawei.com> - 2016-02-22 10:40 +0100

csiph-web