Messages in this thread | | | Subject | Re: [PATCH v3] perf diff: Report noisy for cycles diff | From | "Jin, Yao" <> | Date | Tue, 13 Aug 2019 08:40:47 +0800 |
| |
On 8/12/2019 4:35 PM, Jiri Olsa wrote: > On Sat, Aug 10, 2019 at 07:30:29AM +0800, Jin Yao wrote: > > SNIP > >> static int process_block_per_sym(struct hist_entry *he) >> @@ -684,6 +694,21 @@ static struct hist_entry *get_block_pair(struct hist_entry *he, >> return NULL; >> } >> >> +static void init_spark_values(unsigned long *svals, int num) >> +{ >> + for (int i = 0; i < num; i++) >> + svals[i] = 0; >> +} >> + >> +static void update_spark_value(unsigned long *svals, int num, >> + struct stats *stats, u64 val) >> +{ >> + int n = stats->n; >> + >> + if (n < num) >> + svals[n] = val; >> +} >> + >> static void compute_cycles_diff(struct hist_entry *he, >> struct hist_entry *pair) >> { >> @@ -692,6 +717,23 @@ static void compute_cycles_diff(struct hist_entry *he, >> pair->diff.cycles = >> pair->block_info->cycles_aggr / pair->block_info->num_aggr - >> he->block_info->cycles_aggr / he->block_info->num_aggr; >> + > > should below code be executed only for show_noisy? > > jirka >
Oh, yes, following code should be executed only when show_noisy is enabled. Thanks for pointing out this issue. I will refine the code.
Thanks Jin Yao
>> + init_stats(&pair->diff.stats); >> + init_spark_values(pair->diff.svals, NUM_SPARKS); >> + >> + for (int i = 0; i < pair->block_info->num; i++) { >> + u64 val; >> + >> + if (i >= he->block_info->num || i >= NUM_SPARKS) >> + break; >> + >> + val = labs(pair->block_info->cycles_spark[i] - >> + he->block_info->cycles_spark[i]); >> + >> + update_spark_value(pair->diff.svals, NUM_SPARKS, >> + &pair->diff.stats, val); >> + update_stats(&pair->diff.stats, val); >> + } >> } >> } > > SNIP >
| |