Skip to content

Commit f70cfa0

Browse files
ahunter6acmel
authored andcommitted
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: Adrian 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.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 74d4582 commit f70cfa0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/perf/util/auxtrace.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
942942
struct itrace_synth_opts *synth_opts = opt->value;
943943
const char *p;
944944
char *endptr;
945+
bool period_type_set = false;
945946

946947
synth_opts->set = true;
947948

@@ -970,10 +971,12 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
970971
case 'i':
971972
synth_opts->period_type =
972973
PERF_ITRACE_PERIOD_INSTRUCTIONS;
974+
period_type_set = true;
973975
break;
974976
case 't':
975977
synth_opts->period_type =
976978
PERF_ITRACE_PERIOD_TICKS;
979+
period_type_set = true;
977980
break;
978981
case 'm':
979982
synth_opts->period *= 1000;
@@ -986,6 +989,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
986989
goto out_err;
987990
synth_opts->period_type =
988991
PERF_ITRACE_PERIOD_NANOSECS;
992+
period_type_set = true;
989993
break;
990994
case '\0':
991995
goto out;
@@ -1039,7 +1043,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
10391043
}
10401044
out:
10411045
if (synth_opts->instructions) {
1042-
if (!synth_opts->period_type)
1046+
if (!period_type_set)
10431047
synth_opts->period_type =
10441048
PERF_ITRACE_DEFAULT_PERIOD_TYPE;
10451049
if (!synth_opts->period)

0 commit comments

Comments
 (0)