static int hists__add_entry(struct hists *self, struct addr_location *al, u64 period) { if (__hists__add_entry(self, al, NULL, period) != NULL) return 0; return -ENOMEM; }
static int perf_session__add_hist_entry(struct perf_session *session, struct addr_location *al, struct perf_sample *sample, struct perf_evsel *evsel) { struct symbol *parent = NULL; int err = 0; struct hist_entry *he; if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { err = perf_session__resolve_callchain(session, al->thread, sample->callchain, &parent); if (err) return err; } he = __hists__add_entry(&evsel->hists, al, parent, sample->period); if (he == NULL) return -ENOMEM; if (symbol_conf.use_callchain) { err = callchain_append(he->callchain, &session->callchain_cursor, sample->period); if (err) return err; } /* * Only in the newt browser we are doing integrated annotation, * so we don't allocated the extra space needed because the stdio * code will not use it. */ if (al->sym != NULL && use_browser > 0) { struct annotation *notes = symbol__annotation(he->ms.sym); assert(evsel != NULL); err = -ENOMEM; if (notes->src == NULL && symbol__alloc_hist(he->ms.sym, session->evlist->nr_entries) < 0) goto out; err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); } evsel->hists.stats.total_period += sample->period; hists__inc_nr_events(&evsel->hists, PERF_RECORD_SAMPLE); out: return err; }