Re: [PATCH v1 5/9] perf util: Remove a set of shadow stats static variables

From: Jiri Olsa
Date: Tue Nov 21 2017 - 10:17:47 EST


On Mon, Nov 20, 2017 at 10:43:40PM +0800, Jin Yao wrote:
> In previous patches, we have reconstructed the code and let
> it not access the static variables directly.
>
> This patch removes these static variables.
>
> Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
> ---
> tools/perf/util/stat-shadow.c | 64 ++++++++++---------------------------------
> tools/perf/util/stat.h | 1 +
> 2 files changed, 16 insertions(+), 49 deletions(-)
>
> diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
> index 6f28782..74bcc4d 100644
> --- a/tools/perf/util/stat-shadow.c
> +++ b/tools/perf/util/stat-shadow.c
> @@ -16,28 +16,6 @@
> * AGGR_NONE: Use matching CPU
> * AGGR_THREAD: Not supported?
> */
> -static struct stats runtime_nsecs_stats[MAX_NR_CPUS];
> -static struct stats runtime_cycles_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_stalled_cycles_front_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_stalled_cycles_back_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_branches_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_cacherefs_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_l1_dcache_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_l1_icache_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_ll_cache_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_itlb_cache_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_dtlb_cache_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_cycles_in_tx_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_transaction_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_elision_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_topdown_total_slots[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_topdown_slots_issued[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_topdown_slots_retired[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_topdown_fetch_bubbles[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_topdown_recovery_bubbles[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_smi_num_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct stats runtime_aperf_stats[NUM_CTX][MAX_NR_CPUS];
> -static struct rblist runtime_saved_values;
> static bool have_frontend_stalled;

all this is about switching from array to rb_list for the --per-thread case,
which can be considered as a special use case.. how much do we suffer in
performance with new code? how about the "perf stat -I 100", would it scale
ok for extreme cases (many events in -e or -dddd..)

jirka