lkml.org 
[lkml]   [2021]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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

    \
     
     \ /
      Last update: 2021-12-05 16:14    [W:3.252 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site