@@ -2368,17 +2368,25 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
2368
2368
return err ;
2369
2369
}
2370
2370
2371
- static void calc_percent (struct sym_hist * sym_hist ,
2372
- struct hists * hists ,
2371
+ static void calc_percent (struct annotation * notes ,
2372
+ struct evsel * evsel ,
2373
2373
struct annotation_data * data ,
2374
2374
s64 offset , s64 end )
2375
2375
{
2376
+ struct hists * hists = evsel__hists (evsel );
2377
+ int evidx = evsel -> core .idx ;
2378
+ struct sym_hist * sym_hist = annotation__histogram (notes , evidx );
2376
2379
unsigned int hits = 0 ;
2377
2380
u64 period = 0 ;
2378
2381
2379
2382
while (offset < end ) {
2380
- hits += sym_hist -> addr [offset ].nr_samples ;
2381
- period += sym_hist -> addr [offset ].period ;
2383
+ struct sym_hist_entry * entry ;
2384
+
2385
+ entry = annotated_source__hist_entry (notes -> src , evidx , offset );
2386
+ if (entry ) {
2387
+ hits += entry -> nr_samples ;
2388
+ period += entry -> period ;
2389
+ }
2382
2390
++ offset ;
2383
2391
}
2384
2392
@@ -2415,16 +2423,13 @@ static void annotation__calc_percent(struct annotation *notes,
2415
2423
end = next ? next -> offset : len ;
2416
2424
2417
2425
for_each_group_evsel (evsel , leader ) {
2418
- struct hists * hists = evsel__hists (evsel );
2419
2426
struct annotation_data * data ;
2420
- struct sym_hist * sym_hist ;
2421
2427
2422
2428
BUG_ON (i >= al -> data_nr );
2423
2429
2424
- sym_hist = annotation__histogram (notes , evsel -> core .idx );
2425
2430
data = & al -> data [i ++ ];
2426
2431
2427
- calc_percent (sym_hist , hists , data , al -> offset , end );
2432
+ calc_percent (notes , evsel , data , al -> offset , end );
2428
2433
}
2429
2434
}
2430
2435
}
@@ -2619,14 +2624,19 @@ static void print_summary(struct rb_root *root, const char *filename)
2619
2624
2620
2625
static void symbol__annotate_hits (struct symbol * sym , struct evsel * evsel )
2621
2626
{
2627
+ int evidx = evsel -> core .idx ;
2622
2628
struct annotation * notes = symbol__annotation (sym );
2623
- struct sym_hist * h = annotation__histogram (notes , evsel -> core . idx );
2629
+ struct sym_hist * h = annotation__histogram (notes , evidx );
2624
2630
u64 len = symbol__size (sym ), offset ;
2625
2631
2626
- for (offset = 0 ; offset < len ; ++ offset )
2627
- if (h -> addr [offset ].nr_samples != 0 )
2632
+ for (offset = 0 ; offset < len ; ++ offset ) {
2633
+ struct sym_hist_entry * entry ;
2634
+
2635
+ entry = annotated_source__hist_entry (notes -> src , evidx , offset );
2636
+ if (entry && entry -> nr_samples != 0 )
2628
2637
printf ("%*" PRIx64 ": %" PRIu64 "\n" , BITS_PER_LONG / 2 ,
2629
- sym -> start + offset , h -> addr [offset ].nr_samples );
2638
+ sym -> start + offset , entry -> nr_samples );
2639
+ }
2630
2640
printf ("%*s: %" PRIu64 "\n" , BITS_PER_LONG / 2 , "h->nr_samples" , h -> nr_samples );
2631
2641
}
2632
2642
@@ -2855,8 +2865,14 @@ void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
2855
2865
2856
2866
h -> nr_samples = 0 ;
2857
2867
for (offset = 0 ; offset < len ; ++ offset ) {
2858
- h -> addr [offset ].nr_samples = h -> addr [offset ].nr_samples * 7 / 8 ;
2859
- h -> nr_samples += h -> addr [offset ].nr_samples ;
2868
+ struct sym_hist_entry * entry ;
2869
+
2870
+ entry = annotated_source__hist_entry (notes -> src , evidx , offset );
2871
+ if (entry == NULL )
2872
+ continue ;
2873
+
2874
+ entry -> nr_samples = entry -> nr_samples * 7 / 8 ;
2875
+ h -> nr_samples += entry -> nr_samples ;
2860
2876
}
2861
2877
}
2862
2878
0 commit comments