Commit f70cfa07 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf auxtrace: Fix period type 'i' not working

PERF_ITRACE_PERIOD_INSTRUCTIONS is zero so it got overwritten by the
default period type.

Fix by checking if the period type was set rather than if the value was
zero when applying the default.
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1437150840-31811-12-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 74d4582f
...@@ -942,6 +942,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, ...@@ -942,6 +942,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
struct itrace_synth_opts *synth_opts = opt->value; struct itrace_synth_opts *synth_opts = opt->value;
const char *p; const char *p;
char *endptr; char *endptr;
bool period_type_set = false;
synth_opts->set = true; synth_opts->set = true;
...@@ -970,10 +971,12 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, ...@@ -970,10 +971,12 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
case 'i': case 'i':
synth_opts->period_type = synth_opts->period_type =
PERF_ITRACE_PERIOD_INSTRUCTIONS; PERF_ITRACE_PERIOD_INSTRUCTIONS;
period_type_set = true;
break; break;
case 't': case 't':
synth_opts->period_type = synth_opts->period_type =
PERF_ITRACE_PERIOD_TICKS; PERF_ITRACE_PERIOD_TICKS;
period_type_set = true;
break; break;
case 'm': case 'm':
synth_opts->period *= 1000; synth_opts->period *= 1000;
...@@ -986,6 +989,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, ...@@ -986,6 +989,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
goto out_err; goto out_err;
synth_opts->period_type = synth_opts->period_type =
PERF_ITRACE_PERIOD_NANOSECS; PERF_ITRACE_PERIOD_NANOSECS;
period_type_set = true;
break; break;
case '\0': case '\0':
goto out; goto out;
...@@ -1039,7 +1043,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str, ...@@ -1039,7 +1043,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
} }
out: out:
if (synth_opts->instructions) { if (synth_opts->instructions) {
if (!synth_opts->period_type) if (!period_type_set)
synth_opts->period_type = synth_opts->period_type =
PERF_ITRACE_DEFAULT_PERIOD_TYPE; PERF_ITRACE_DEFAULT_PERIOD_TYPE;
if (!synth_opts->period) if (!synth_opts->period)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment