}
notes = symbol__annotation(sym);
- if (notes->src != NULL) {
- pthread_mutex_lock(¬es->lock);
- goto out_assign;
- }
-
pthread_mutex_lock(¬es->lock);
- if (symbol__alloc_hist(sym) < 0) {
+ if (!symbol__hists(sym, top->evlist->nr_entries)) {
pthread_mutex_unlock(¬es->lock);
pr_err("Not enough memory for annotating '%s' symbol!\n",
sym->name);
err = symbol__annotate(sym, map, evsel, 0, NULL);
if (err == 0) {
-out_assign:
top->sym_filter_entry = he;
} else {
char msg[BUFSIZ];
notes = symbol__annotation(dl->ops.target.sym);
pthread_mutex_lock(¬es->lock);
- if (notes->src == NULL && symbol__alloc_hist(dl->ops.target.sym) < 0) {
+ if (!symbol__hists(dl->ops.target.sym, evsel->evlist->nr_entries)) {
pthread_mutex_unlock(¬es->lock);
ui__warning("Not enough memory for annotating '%s' symbol!\n",
dl->ops.target.sym->name);
return src;
}
-static void annotated_source__delete(struct annotated_source *src)
+static __maybe_unused void annotated_source__delete(struct annotated_source *src)
{
if (src == NULL)
return;
return src->histograms ? 0 : -1;
}
-int symbol__alloc_hist(struct symbol *sym)
-{
- size_t size = symbol__size(sym);
- struct annotation *notes = symbol__annotation(sym);
-
- notes->src = annotated_source__new();
- if (notes->src == NULL)
- return -1;
-
- if (annotated_source__alloc_histograms(notes->src, size, symbol_conf.nr_events) < 0) {
- annotated_source__delete(notes->src);
- notes->src = NULL;
- return -1;
- }
- return 0;
-}
-
/* The cycles histogram is lazily allocated. */
static int symbol__alloc_hist_cycles(struct symbol *sym)
{
return notes->src->cycles_hist;
}
-static struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists)
+struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists)
{
struct annotation *notes = symbol__annotation(sym);
int hist_entry__inc_addr_samples(struct hist_entry *he, struct perf_sample *sample,
struct perf_evsel *evsel, u64 addr);
-int symbol__alloc_hist(struct symbol *sym);
+struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists);
void symbol__annotate_zero_histograms(struct symbol *sym);
int symbol__annotate(struct symbol *sym, struct map *map,