Re: [PATCH v1 3/9] perf util: Reconstruct rblist for supporting per-thread shadow stats

From: Jin, Yao
Date: Tue Nov 21 2017 - 20:36:06 EST




On 11/21/2017 11:17 PM, Jiri Olsa wrote:
On Mon, Nov 20, 2017 at 10:43:38PM +0800, Jin Yao wrote:

SNIP

+static void init_saved_rblist(struct rblist *rblist)
+{
+ rblist__init(rblist);
+ rblist->node_cmp = saved_value_cmp;
+ rblist->node_new = saved_value_new;
+ rblist->node_delete = saved_value_delete;
+}
+
+static void free_saved_rblist(struct rblist *rblist)
+{
+ rblist__reset(rblist);
+}

I don't see a reason for this code to be in separate
functions.. could go directly in:
perf_stat__init_runtime_stat
perf_stat__free_runtime_stat

jirka


Agree, that's better.

I will put this code in perf_stat__init_runtime_stat and perf_stat__free_runtime_stat.

Thanks
Jin Yao

+
+void perf_stat__init_runtime_stat(struct runtime_stat *stat)
+{
+ memset(stat, 0, sizeof(struct runtime_stat));
+ init_saved_rblist(&stat->value_list);
+}
+
+void perf_stat__free_runtime_stat(struct runtime_stat *stat)
+{
+ free_saved_rblist(&stat->value_list);
+}
+

SNIP