perf record: Let user have timestamps with per-thread recording
Adrian Hunter
reviewerPATCH 1/1 perf record: Let user have timestamps with per-thread recording
If the option -T is used with option --per-thread, then time is still not sampled. Fix that by using OPT_BOOLEAN_SET to distinguish when the user used the -T option as opposed to the default case when timestamps are enabled but only for per-cpu recording.
--- tools/perf/builtin-record.c | 4 +++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +3 -1
@@ -1030,7 +1030,9 @@ struct option __record_options[] = {OPT_BOOLEAN ('s' ,"stat" , &record.opts.inherit_stat,"per thread counts" ),OPT_BOOLEAN ('d' ,"data" , &record.opts.sample_address,"Record the sample addresses" ), -OPT_BOOLEAN ('T' ,"timestamp" , &record.opts.sample_time,"Record the sample timestamps" ), +OPT_BOOLEAN_SET ('T' ,"timestamp" , &record.opts.sample_time, + &record.opts.sample_time_set, +"Record the sample timestamps" ),OPT_BOOLEAN ('P' ,"period" , &record.opts.period,"Record the sample period" ),OPT_BOOLEAN ('n' ,"no-samples" , &record.opts.no_samples, "don't sample"),
tools/perf/perf.h +1 -0
@@ -51,6 +51,7 @@ struct record_opts {bool sample_address;bool sample_weight;bool sample_time; +bool sample_time_set;bool period;bool sample_intr_regs;bool running_time;
tools/perf/util/evsel.c +2 -1
@@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)*/ if (opts->sample_time && (!perf_missing_features.sample_id_all && - (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu))) + (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu || + opts->sample_time_set)))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples && !evsel->no_aux_samples) {
Signature · 1 line
1.9.1
Quoted 6 lines · Adrian Hunter
tools/perf/util/evsel.c +0
-0
tools/perf/util/evsel.c void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) · line 714
Quoted 9 lines
tools/perf/util/evsel.c +2
-1@@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)*/ if (opts->sample_time && (!perf_missing_features.sample_id_all && - (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu))) + (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu || + opts->sample_time_set)))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples && !evsel->no_aux_samples) {
Why is the sample_time_set even needed? If a user or a command asks for sample time the bit should be set. This seems crazy that underlying code is ignoring the request.
Adrian Hunter
reviewerQuoted 15 lines · David Ahern
Quoted 14 lines · Adrian Hunter
tools/perf/util/evsel.c +2
-1@@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel,struct record_opts *opts) */ if (opts->sample_time && (!perf_missing_features.sample_id_all && - (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu))) + (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu || + opts->sample_time_set)))perf_evsel__set_sample_bit (evsel,TIME );
Quoted 6 lines
Quoted 2 lines
if (opts->raw_samples && !evsel->no_aux_samples) {Why is the
sample_time_seteven needed? If a user or a command asks for sample time the bit should be set. This seems crazy that underlying code is ignoring the request.
sample_time defaults to true, so there is no way to know if the user set it without sample_time_set.
tip-bot for Adrian Hunter
merge botperf record: Let user have timestamps with per-thread recording
Commit-ID: 3abebc55d70b6e3247d1f0e34c0bb906e40d2a18 Gitweb: http://git.kernel.org/tip/3abebc55d70b6e3247d1f0e34c0bb906e40d2a18 Author: Adrian Hunter <[email protected]> AuthorDate: Mon, 6 Jul 2015 14:51:01 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 6 Jul 2015 08:58:36 -0300
perf record: Let user have timestamps with per-thread recording
If the option -T is used with option --per-thread, then time is still not sampled. Fix that by using OPT_BOOLEAN_SET to distinguish when the user used the -T option as opposed to the default case when timestamps are enabled but only for per-cpu recording.
--- tools/perf/builtin-record.c | 4 +++- tools/perf/perf.h | 1 + tools/perf/util/evsel.c | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +3 -1
@@ -1030,7 +1030,9 @@ struct option __record_options[] = {OPT_BOOLEAN ('s' ,"stat" , &record.opts.inherit_stat,"per thread counts" ),OPT_BOOLEAN ('d' ,"data" , &record.opts.sample_address,"Record the sample addresses" ), -OPT_BOOLEAN ('T' ,"timestamp" , &record.opts.sample_time,"Record the sample timestamps" ), +OPT_BOOLEAN_SET ('T' ,"timestamp" , &record.opts.sample_time, + &record.opts.sample_time_set, +"Record the sample timestamps" ),OPT_BOOLEAN ('P' ,"period" , &record.opts.period,"Record the sample period" ),OPT_BOOLEAN ('n' ,"no-samples" , &record.opts.no_samples, "don't sample"),
tools/perf/perf.h +1 -0
@@ -51,6 +51,7 @@ struct record_opts {bool sample_address;bool sample_weight;bool sample_time; +bool sample_time_set;bool period;bool sample_intr_regs;bool running_time;
tools/perf/util/evsel.c +2 -1
@@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)*/ if (opts->sample_time && (!perf_missing_features.sample_id_all && - (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu))) + (!opts->no_inherit ||target__has_cpu (&opts->target) || per_cpu || + opts->sample_time_set)))perf_evsel__set_sample_bit (evsel,TIME );if (opts->raw_samples && !evsel->no_aux_samples) {