Commit 7c10b65a authored by Leo Yan's avatar Leo Yan Committed by Arnaldo Carvalho de Melo

perf c2c: Refactor node header

The node header array contains 3 items, each item is used for one of
the 3 flavors for node accessing info.  To extend sorting on other
snooping type and not always stick to HITMs, the second header string
"Node{cpus %hitms %stores}" should be adjusted (e.g. it's changed as
"Node{cpus %peer %stores}").

For this reason, this patch changes the node header array to three
flat variables and uses switch-case in function setup_nodes_header(),
thus it is easier for altering the header string.
Reviewed-by: default avatarAli Saidi <alisaidi@amazon.com>
Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
Tested-by: default avatarAli Saidi <alisaidi@amazon.com>
Acked-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Like Xu <likexu@tencent.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Timothy Hayes <timothy.hayes@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Link: https://lore.kernel.org/r/20220811062451.435810-12-leo.yan@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2be0bc75
...@@ -1723,12 +1723,6 @@ static struct c2c_dimension dim_dso = { ...@@ -1723,12 +1723,6 @@ static struct c2c_dimension dim_dso = {
.se = &sort_dso, .se = &sort_dso,
}; };
static struct c2c_header header_node[3] = {
HEADER_LOW("Node"),
HEADER_LOW("Node{cpus %hitms %stores}"),
HEADER_LOW("Node{cpu list}"),
};
static struct c2c_dimension dim_node = { static struct c2c_dimension dim_node = {
.name = "node", .name = "node",
.cmp = empty_cmp, .cmp = empty_cmp,
...@@ -2229,9 +2223,27 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused) ...@@ -2229,9 +2223,27 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused)
return 0; return 0;
} }
static struct c2c_header header_node_0 = HEADER_LOW("Node");
static struct c2c_header header_node_1 = HEADER_LOW("Node{cpus %hitms %stores}");
static struct c2c_header header_node_2 = HEADER_LOW("Node{cpu list}");
static void setup_nodes_header(void) static void setup_nodes_header(void)
{ {
dim_node.header = header_node[c2c.node_info]; switch (c2c.node_info) {
case 0:
dim_node.header = header_node_0;
break;
case 1:
dim_node.header = header_node_1;
break;
case 2:
dim_node.header = header_node_2;
break;
default:
break;
}
return;
} }
static int setup_nodes(struct perf_session *session) static int setup_nodes(struct perf_session *session)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment