Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
f70cfa07 74d4582f

+5 -1
+5 -1
tools/perf/util/auxtrace.c
··· 942 942 struct itrace_synth_opts *synth_opts = opt->value; 943 943 const char *p; 944 944 char *endptr; 945 + bool period_type_set = false; 945 946 946 947 synth_opts->set = true; 947 948 ··· 971 970 case 'i': 972 971 synth_opts->period_type = 973 972 PERF_ITRACE_PERIOD_INSTRUCTIONS; 973 + period_type_set = true; 974 974 break; 975 975 case 't': 976 976 synth_opts->period_type = 977 977 PERF_ITRACE_PERIOD_TICKS; 978 + period_type_set = true; 978 979 break; 979 980 case 'm': 980 981 synth_opts->period *= 1000; ··· 989 986 goto out_err; 990 987 synth_opts->period_type = 991 988 PERF_ITRACE_PERIOD_NANOSECS; 989 + period_type_set = true; 992 990 break; 993 991 case '\0': 994 992 goto out; ··· 1043 1039 } 1044 1040 out: 1045 1041 if (synth_opts->instructions) { 1046 - if (!synth_opts->period_type) 1042 + if (!period_type_set) 1047 1043 synth_opts->period_type = 1048 1044 PERF_ITRACE_DEFAULT_PERIOD_TYPE; 1049 1045 if (!synth_opts->period)