LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 7/7] perf tools: Add --sample-cpu option to record command
Date: Mon,  1 Aug 2016 20:02:35 +0200
Message-ID: <1470074555-24889-8-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1470074555-24889-1-git-send-email-jolsa@kernel.org>

Adding --sample-cpu option to be able to explicitly enable
CPU sample type. Currently it's only enable implicitly
in case the target is cpu related.

It will be useful for following c2c record tool.

Link: http://lkml.kernel.org/n/tip-mjiw2om6jv2ypl66e74ssijt@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/Documentation/perf-record.txt | 3 +++
 tools/perf/builtin-record.c              | 1 +
 tools/perf/perf.h                        | 1 +
 tools/perf/util/evsel.c                  | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 69966abf65d1..379a2bed07c0 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -192,6 +192,9 @@ OPTIONS
 --period::
 	Record the sample period.
 
+--sample-cpu::
+	Record the sample cpu.
+
 -n::
 --no-samples::
 	Don't sample.
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 8f2c16d9275f..6355902fbfc8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1434,6 +1434,7 @@ 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(0, "sample-cpu", &record.opts.sample_cpu, "Record the sample cpu"),
 	OPT_BOOLEAN_SET('T', "timestamp", &record.opts.sample_time,
 			&record.opts.sample_time_set,
 			"Record the sample timestamps"),
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index a7e0f1497244..cb0f1356ff81 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -52,6 +52,7 @@ struct record_opts {
 	bool	     sample_weight;
 	bool	     sample_time;
 	bool	     sample_time_set;
+	bool	     sample_cpu;
 	bool	     period;
 	bool	     running_time;
 	bool	     full_auxtrace;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 8c54df61fe64..e7bc833e21aa 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -854,7 +854,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
 		perf_evsel__set_sample_bit(evsel, REGS_INTR);
 	}
 
-	if (target__has_cpu(&opts->target))
+	if (target__has_cpu(&opts->target) || opts->sample_cpu)
 		perf_evsel__set_sample_bit(evsel, CPU);
 
 	if (opts->period)
-- 
2.4.11

  parent reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 18:02 [PATCH 0/7] perf tools: Several fixes Jiri Olsa
2016-08-01 18:02 ` [PATCH 1/7] tools lib: Add bitmap_alloc function Jiri Olsa
2016-08-01 18:45   ` David Ahern
2016-08-02  9:33     ` Jiri Olsa
2016-08-02 11:33       ` [PATCHv2 " Jiri Olsa
2016-08-02 12:56         ` Arnaldo Carvalho de Melo
2016-08-02 13:03           ` Jiri Olsa
2016-08-04  9:11         ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2016-08-01 18:02 ` [PATCH 2/7] tools lib: Add bitmap_snprintf function Jiri Olsa
2016-08-02 15:25   ` Arnaldo Carvalho de Melo
2016-08-04  9:11   ` [tip:perf/urgent] tools lib: Add bitmap_scnprintf function tip-bot for Jiri Olsa
2016-08-01 18:02 ` [PATCH 3/7] tools lib: Add bitmap_and function Jiri Olsa
2016-08-04  9:11   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2016-08-01 18:02 ` [PATCH 4/7] perf tests: Add test for bitmap_snprintf function Jiri Olsa
2016-08-04  9:12   ` [tip:perf/urgent] perf tests: Add test for bitmap_scnprintf function tip-bot for Jiri Olsa
2016-08-01 18:02 ` [PATCH 5/7] perf tools: Move config/Makefile into Makefile.config Jiri Olsa
2016-08-04  9:13   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2016-08-01 18:02 ` [PATCH 6/7] perf tools: Introduce hists__output_resort_cb function Jiri Olsa
2016-08-04  9:13   ` [tip:perf/urgent] perf hists: Introduce output_resort_cb method tip-bot for Jiri Olsa
2016-08-01 18:02 ` Jiri Olsa [this message]
2016-08-04  9:14   ` [tip:perf/urgent] perf record: Add --sample-cpu option tip-bot for Jiri Olsa

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470074555-24889-8-git-send-email-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git