Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap

2020-05-15 Thread Jiri Olsa
On Fri, May 15, 2020 at 02:35:43PM -0700, Ian Rogers wrote: > On Fri, May 15, 2020 at 12:41 PM Jiri Olsa wrote: > > > > On Fri, May 15, 2020 at 09:50:07AM -0700, Ian Rogers wrote: > > > > SNIP > > > > > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > > > index b071df37

Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap

2020-05-15 Thread Jiri Olsa
On Fri, May 15, 2020 at 09:50:07AM -0700, Ian Rogers wrote: SNIP > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c > index 8b4ce704a68d..f64ab91c432b 100644 > --- a/tools/perf/util/expr.c > +++ b/tools/perf/util/expr.c > @@ -4,25 +4,76 @@ > #include "expr.h" > #include "expr-bison.

Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap

2020-05-15 Thread Jiri Olsa
On Fri, May 15, 2020 at 09:50:07AM -0700, Ian Rogers wrote: SNIP > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c > index b071df373f8b..37be5a368d6e 100644 > --- a/tools/perf/util/metricgroup.c > +++ b/tools/perf/util/metricgroup.c > @@ -85,8 +85,7 @@ static void metri

Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap

2020-05-15 Thread Andrii Nakryiko
On Fri, May 15, 2020 at 9:51 AM Ian Rogers wrote: > > Use a hashmap between a char* string and a double* value. While bpf's > hashmap entries are size_t in size, we can't guarantee sizeof(size_t) >= > sizeof(double). Avoid a memory allocation when gathering ids by making 0.0 > a special value enco