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


Groups > linux.kernel > #1436693

[PATCH 09/16] perf tests: Fix hist accumulation test

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 09/16] perf tests: Fix hist accumulation test
Date 2016-07-05 02:50 +0200
Message-ID <rRmIO-48U-15@gated-at.bofh.it> (permalink)
References <rRmz7-45F-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jiri Olsa <jolsa@kernel.org>

User's values from .perfconfig could overload the default callchain
setup and cause this test to fail.  Making sure the test is using
default callchain_param values.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1467634583-29147-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/hists_cumulate.c |  4 ++++
 tools/perf/util/callchain.h       |  1 +
 tools/perf/util/util.c            | 19 +++++++++++++------
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index a9e3db3afac4..9fd54b79a788 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -216,6 +216,8 @@ static int do_test(struct hists *hists, struct result *expected, size_t nr_expec
 
 		/* check callchain entries */
 		root = &he->callchain->node.rb_root;
+
+		TEST_ASSERT_VAL("callchains expected", !RB_EMPTY_ROOT(root));
 		cnode = rb_entry(rb_first(root), struct callchain_node, rb_node);
 
 		c = 0;
@@ -666,6 +668,8 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
 	perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
 	setup_sorting(NULL);
+
+	callchain_param = callchain_param_default;
 	callchain_register_param(&callchain_param);
 
 	err = add_hist_entries(hists, machine);
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index a70f6b54eb92..13e75549c440 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -106,6 +106,7 @@ struct callchain_param {
 };
 
 extern struct callchain_param callchain_param;
+extern struct callchain_param callchain_param_default;
 
 struct callchain_list {
 	u64			ip;
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index e08b9a092a23..5f44a21955cd 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -19,12 +19,19 @@
 #include "callchain.h"
 #include "strlist.h"
 
-struct callchain_param	callchain_param = {
-	.mode	= CHAIN_GRAPH_ABS,
-	.min_percent = 0.5,
-	.order  = ORDER_CALLEE,
-	.key	= CCKEY_FUNCTION,
-	.value	= CCVAL_PERCENT,
+#define CALLCHAIN_PARAM_DEFAULT			\
+	.mode		= CHAIN_GRAPH_ABS,	\
+	.min_percent	= 0.5,			\
+	.order		= ORDER_CALLEE,		\
+	.key		= CCKEY_FUNCTION,	\
+	.value		= CCVAL_PERCENT,	\
+
+struct callchain_param callchain_param = {
+	CALLCHAIN_PARAM_DEFAULT
+};
+
+struct callchain_param callchain_param_default = {
+	CALLCHAIN_PARAM_DEFAULT
 };
 
 /*
-- 
2.7.4

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


Thread

[GIT PULL 00/16] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:40 +0200
  [PATCH 10/16] perf unwind: Add initialized arg into unwind__prepare_access Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:40 +0200
  [PATCH 07/16] perf buildid-cache: Scan and import user SDT events to probe cache Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:40 +0200
  [PATCH 14/16] tools lib subcmd: Respect WERROR=0 for build Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 01/16] perf probe: Use cache entry if possible Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 05/16] perf sdt: ELF support for SDT Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 13/16] tools lib api: Respect WERROR=0 for build Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 08/16] perf header: Transform nodes string info to struct Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 09/16] perf tests: Fix hist accumulation test Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 16/16] perf tools: Sync copy of syscall_64.tbl with the kernel Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 15/16] perf tools: Update android build documentation Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  [PATCH 12/16] tools lib bpf: Add license header Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-07-05 02:50 +0200
  Re: [GIT PULL 00/16] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-07-05 12:20 +0200

csiph-web