Re: [PATCH 13/17] perf tools: Add perf_config_u64 function

From: Jiri Olsa
Date: Sun Jun 15 2014 - 13:49:03 EST


On Fri, Jun 13, 2014 at 09:07:43PM +0900, Namhyung Kim wrote:
> 2014-06-13 (ê), 00:08 +0200, Jiri Olsa:
> > From: Jiri Olsa <jolsa@xxxxxxxxxx>
> >
> > Adding perf_config_u64 function to be able to parse
> > 'llong' values out of config file.
> >
> > Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
> > Cc: David Ahern <dsahern@xxxxxxxxx>
> > Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
> > Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> > Cc: Jean Pihet <jean.pihet@xxxxxxxxxx>
> > Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> > Cc: Paul Mackerras <paulus@xxxxxxxxx>
> > Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> > tools/perf/util/cache.h | 1 +
> > tools/perf/util/config.c | 22 ++++++++++++++++++++++
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
> > index 7b176dd..5cf9e1b 100644
> > --- a/tools/perf/util/cache.h
> > +++ b/tools/perf/util/cache.h
> > @@ -22,6 +22,7 @@ typedef int (*config_fn_t)(const char *, const char *, void *);
> > extern int perf_default_config(const char *, const char *, void *);
> > extern int perf_config(config_fn_t fn, void *);
> > extern int perf_config_int(const char *, const char *);
> > +extern u64 perf_config_u64(const char *, const char *);
> > extern int perf_config_bool(const char *, const char *);
> > extern int config_error_nonbool(const char *);
> > extern const char *perf_config_dirname(const char *, const char *);
> > diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c
> > index 24519e1..e68bbe3 100644
> > --- a/tools/perf/util/config.c
> > +++ b/tools/perf/util/config.c
> > @@ -286,6 +286,20 @@ static int parse_unit_factor(const char *end, unsigned long *val)
> > return 0;
> > }
> >
> > +static int perf_parse_llong(const char *value, long long *ret)
> > +{
> > + if (value && *value) {
> > + char *end;
> > + long val = strtoll(value, &end, 0);
>
> Why not declare the val as long long?

copy/paste error ;-)

>
> > + unsigned long factor = 1;
>
> Also please add a blank line between declaration and actual body.

ook, thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/