[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140813114822.GD2370@krava.brq.redhat.com>
Date: Wed, 13 Aug 2014 13:48:22 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>,
Paul Mackerras <paulus@...ba.org>,
Namhyung Kim <namhyung.kim@....com>,
LKML <linux-kernel@...r.kernel.org>,
David Ahern <dsahern@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH 03/13] perf annotate: Move session handling out of
__cmd_annotate()
On Tue, Aug 12, 2014 at 03:40:35PM +0900, Namhyung Kim wrote:
SNIP
>
> @@ -301,6 +281,10 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
> .ordering_requires_timestamps = true,
> },
> };
> + struct perf_data_file file = {
> + .path = input_name,
> + .mode = PERF_DATA_MODE_READ,
> + };
> const struct option options[] = {
> OPT_STRING('i', "input", &input_name, "file",
> "input file name"),
> @@ -308,7 +292,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
> "only consider symbols in these dsos"),
> OPT_STRING('s', "symbol", &annotate.sym_hist_filter, "symbol",
> "symbol to annotate"),
> - OPT_BOOLEAN('f', "force", &annotate.force, "don't complain, do it"),
> + OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"),
> OPT_INCR('v', "verbose", &verbose,
> "be more verbose (show symbol address, etc)"),
> OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
> @@ -341,6 +325,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
> "Show event group information together"),
> OPT_END()
> };
> + int ret;
>
> argc = parse_options(argc, argv, options, annotate_usage, 0);
>
> @@ -353,11 +338,16 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
>
> setup_browser(true);
>
> + annotate.session = perf_session__new(&file, false, &annotate.tool);
> + if (annotate.session == NULL)
> + return -ENOMEM;
I know you're just moving code, but perf_session__new could
fail for more reasons than just ENOMEM, which is the most
unlikely case ;-) -1 is probably better option here
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists