Skip to content

Commit

Permalink
perf tests: Fix hist accumulation test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Jul 4, 2016
1 parent c60da22 commit 347ca87
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions tools/perf/tests/hists_cumulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/callchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 13 additions & 6 deletions tools/perf/util/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/*
Expand Down

0 comments on commit 347ca87

Please sign in to comment.