From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754602AbbLJHyl (ORCPT ); Thu, 10 Dec 2015 02:54:41 -0500 Received: from LGEAMRELO11.lge.com ([156.147.23.51]:46373 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753832AbbLJHxq (ORCPT ); Thu, 10 Dec 2015 02:53:46 -0500 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: namhyung@kernel.org X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Ingo Molnar , Peter Zijlstra , Jiri Olsa , LKML , David Ahern , Frederic Weisbecker , Andi Kleen , Stephane Eranian , Adrian Hunter Subject: [PATCH/RFC 16/16] perf tools: Skip dso front cache for multi-threaded lookup Date: Thu, 10 Dec 2015 16:53:35 +0900 Message-Id: <1449734015-9148-17-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1449734015-9148-1-git-send-email-namhyung@kernel.org> References: <1449734015-9148-1-git-send-email-namhyung@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the dso maintains a front cache for faster symbol lookup, but access to it should be synchronized when multi thread is used. Also it doesn't help much if data file has callchains since it should walk through the callchains for each sample so single cache is almost meaningless. So skip the cache if mult-thread is enabled. Signed-off-by: Namhyung Kim --- tools/perf/builtin-top.c | 2 ++ tools/perf/util/symbol.c | 3 +++ tools/perf/util/symbol.h | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index fc9715b046b3..d69069d57f8c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1225,6 +1225,8 @@ static int __cmd_top(struct perf_top *top) if ((int)top->nr_threads > top->evlist->nr_mmaps) top->nr_threads = top->evlist->nr_mmaps; + symbol_conf.multi_thread = (top->nr_threads > 1); + nr_idx = top->evlist->nr_mmaps / top->nr_threads; rem = top->evlist->nr_mmaps % top->nr_threads; diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index d51abd2e7865..d4a966004fa0 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -454,6 +454,9 @@ void dso__reset_find_symbol_cache(struct dso *dso) struct symbol *dso__find_symbol(struct dso *dso, enum map_type type, u64 addr) { + if (symbol_conf.multi_thread) + return symbols__find(&dso->symbols[type], addr); + if (dso->last_find_result[type].addr != addr) { dso->last_find_result[type].addr = addr; dso->last_find_result[type].symbol = symbols__find(&dso->symbols[type], addr); diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 857f707ac12b..68c198f64e1d 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -109,7 +109,8 @@ struct symbol_conf { branch_callstack, has_filter, show_ref_callgraph, - hide_unresolved; + hide_unresolved, + multi_thread; const char *vmlinux_name, *kallsyms_name, *source_prefix, -- 2.6.2