Commit 483b3bb3 authored by Yang Jihong's avatar Yang Jihong Committed by Zheng Zengkai
Browse files

perf c2c: Refactor node header

maillist inclusion
category: Feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I53L83
CVE: NA

Reference: https://lore.kernel.org/all/20210104020930.GA4897@leoy-ThinkPad-X240s/



-------------------

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 all load
references 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 %loads %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.

Signed-off-by: default avatarLeo Yan <leo.yan@linaro.org>
Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Reviewed-by: default avatarHanjun Guo <guohanjun@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 6d9ee5b3
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -1810,12 +1810,6 @@ static struct c2c_dimension dim_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 = {
	.name		= "node",
	.cmp		= empty_cmp,
@@ -2294,9 +2288,27 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused)
	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)
{
	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)