[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YazWyEU9cUabmmYC@krava>
Date: Sun, 5 Dec 2021 16:13:46 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Alexey Bayduraev <alexey.v.bayduraev@...ux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Antonov <alexander.antonov@...ux.intel.com>,
Alexei Budankov <abudankov@...wei.com>,
Riccardo Mancini <rickyman7@...il.com>
Subject: Re: [PATCH v12 13/16] perf record: Extend --threads command line
option
On Tue, Nov 23, 2021 at 05:08:09PM +0300, Alexey Bayduraev wrote:
SNIP
> +
> static int record__parse_threads(const struct option *opt, const char *str, int unset)
> {
> + int s;
> struct record_opts *opts = opt->value;
>
> - if (unset || !str || !strlen(str))
> + if (unset || !str || !strlen(str)) {
> opts->threads_spec = THREAD_SPEC__CPU;
> + } else {
> + for (s = 1; s < THREAD_SPEC__MAX; s++) {
> + if (s == THREAD_SPEC__USER) {
> + opts->threads_user_spec = strdup(str);
we should bail out if strdup fails
jirka
> + opts->threads_spec = THREAD_SPEC__USER;
> + break;
> + }
> + if (!strncasecmp(str, thread_spec_tags[s], strlen(thread_spec_tags[s]))) {
> + opts->threads_spec = s;
> + break;
> + }
> + }
> + }
> +
> + if (opts->threads_spec == THREAD_SPEC__USER)
> + pr_debug("threads_spec: %s\n", opts->threads_user_spec);
> + else
> + pr_debug("threads_spec: %s\n", thread_spec_tags[opts->threads_spec]);
>
> return 0;
> }
> @@ -3263,6 +3327,17 @@ static void record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_c
> set_bit(cpus->map[c], mask->bits);
> }
>
SNIP
Powered by blists - more mailing lists