linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf record: Let user have timestamps with per-thread recording
@ 2015-07-06 11:51 Adrian Hunter
  2015-07-06 15:31 ` David Ahern
  2015-07-06 16:33 ` [tip:perf/core] " tip-bot for Adrian Hunter
  0 siblings, 2 replies; 4+ messages in thread
From: Adrian Hunter @ 2015-07-06 11:51 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, David Ahern

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.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 tools/perf/builtin-record.c | 4 +++-
 tools/perf/perf.h           | 1 +
 tools/perf/util/evsel.c     | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index de165a1b9240..283fe96bdfc1 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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"),
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 4a5827fff799..937b16aa0300 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -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;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6be3c01ff6f8..ec98e5b4e14e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf record: Let user have timestamps with per-thread recording
  2015-07-06 11:51 [PATCH] perf record: Let user have timestamps with per-thread recording Adrian Hunter
@ 2015-07-06 15:31 ` David Ahern
  2015-07-07  7:32   ` Adrian Hunter
  2015-07-06 16:33 ` [tip:perf/core] " tip-bot for Adrian Hunter
  1 sibling, 1 reply; 4+ messages in thread
From: David Ahern @ 2015-07-06 15:31 UTC (permalink / raw)
  To: Adrian Hunter, Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim

On 7/6/15 5:51 AM, Adrian Hunter wrote:
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index 6be3c01ff6f8..ec98e5b4e14e 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/core] perf record: Let user have timestamps with per-thread recording
  2015-07-06 11:51 [PATCH] perf record: Let user have timestamps with per-thread recording Adrian Hunter
  2015-07-06 15:31 ` David Ahern
@ 2015-07-06 16:33 ` tip-bot for Adrian Hunter
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Adrian Hunter @ 2015-07-06 16:33 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, tglx, namhyung, dsahern, hpa, mingo, adrian.hunter,
	linux-kernel, acme

Commit-ID:  3abebc55d70b6e3247d1f0e34c0bb906e40d2a18
Gitweb:     http://git.kernel.org/tip/3abebc55d70b6e3247d1f0e34c0bb906e40d2a18
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Mon, 6 Jul 2015 14:51:01 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1436183461-1918-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 4 +++-
 tools/perf/perf.h           | 1 +
 tools/perf/util/evsel.c     | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index de165a1..283fe96 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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"),
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 4a5827ff..937b16a 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -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;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 6cc97f3..83c0803 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf record: Let user have timestamps with per-thread recording
  2015-07-06 15:31 ` David Ahern
@ 2015-07-07  7:32   ` Adrian Hunter
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2015-07-07  7:32 UTC (permalink / raw)
  To: David Ahern
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Jiri Olsa, Namhyung Kim

On 06/07/15 18:31, David Ahern wrote:
> On 7/6/15 5:51 AM, Adrian Hunter wrote:
>> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
>> index 6be3c01ff6f8..ec98e5b4e14e 100644
>> --- a/tools/perf/util/evsel.c
>> +++ b/tools/perf/util/evsel.c
>> @@ -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.

sample_time defaults to true, so there is no way to know if the user set it
without sample_time_set.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-07  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06 11:51 [PATCH] perf record: Let user have timestamps with per-thread recording Adrian Hunter
2015-07-06 15:31 ` David Ahern
2015-07-07  7:32   ` Adrian Hunter
2015-07-06 16:33 ` [tip:perf/core] " tip-bot for Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).