Re: [PATCH 1/4] perf annotate: Add a hashmap for symbol histogram

From: Namhyung Kim
Date: Wed Feb 28 2024 - 00:21:48 EST


On Tue, Feb 27, 2024 at 5:20 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Tue, Feb 27, 2024 at 4:52 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Now symbol histogram uses an array to save per-offset sample counts.
> > But it wastes a lot of memory if the symbol has a few samples only.
> > Add a hashmap to save values only for actual samples.
> >
> > For now, it has duplicate histogram (one in the existing array and
> > another in the new hash map). Once it can convert to use the hash
> > in all places, we can get rid of the array later.
> >
> > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > ---
[SNIP]
> > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
> > index 94435607c958..a2b0c8210740 100644
> > --- a/tools/perf/util/annotate.h
> > +++ b/tools/perf/util/annotate.h
> > @@ -12,6 +12,7 @@
> > #include "symbol_conf.h"
> > #include "mutex.h"
> > #include "spark.h"
> > +#include "hashmap.h"
>
> nit: This could just be a forward reference to keep the number of
> header files down.

Sounds good. Will fix in v2.

Thanks for your review!
Namhyung