All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andi Kleen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, jolsa@kernel.org, mingo@kernel.org,
	ak@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Subject: [tip:perf/core] perf record: Synthesize thread map and cpu map
Date: Wed, 6 Dec 2017 08:32:17 -0800	[thread overview]
Message-ID: <tip-373565d285e8d2113f1b6c0a2e461b9c8d0da1c9@git.kernel.org> (raw)
In-Reply-To: <20171117214300.32746-3-andi@firstfloor.org>

Commit-ID:  373565d285e8d2113f1b6c0a2e461b9c8d0da1c9
Gitweb:     https://git.kernel.org/tip/373565d285e8d2113f1b6c0a2e461b9c8d0da1c9
Author:     Andi Kleen <ak@linux.intel.com>
AuthorDate: Fri, 17 Nov 2017 13:42:59 -0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 29 Nov 2017 18:18:00 -0300

perf record: Synthesize thread map and cpu map

Synthesize the per attr thread maps and cpu maps in 'perf record'.

This allows code from 'perf stat' called from 'perf script' to access
this information.

Committer testing:

Please see the PERF_RECORD_THREAD_MAP and PERF_RECORD_CPU_MAP records,
added by this patch:

  $ perf record sleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
  $ perf report -D | grep PERF_RECORD_ | head
  0xe8 [0x20]: PERF_RECORD_TIME_CONV: unhandled!
  0x108 [0x28]: PERF_RECORD_THREAD_MAP nr: 1 thread: 23568
  0x130 [0x18]: PERF_RECORD_CPU_MAP: 0-3
  0 0x148 [0x28]: PERF_RECORD_COMM: perf:23568/23568
  0x570 [0x8]: PERF_RECORD_FINISHED_ROUND
  445342677837144 0x170 [0x28]: PERF_RECORD_COMM exec: sleep:23568/23568
  445342677847339 0x198 [0x68]: PERF_RECORD_MMAP2 23568/23568: [0x564c943a4000(0x208000) @ 0 fd:00 3147174 2566255743]: r-xp /usr/bin/sleep
  445342677862450 0x200 [0x70]: PERF_RECORD_MMAP2 23568/23568: [0x7f25968a8000(0x229000) @ 0 fd:00 3151761 2566238119]: r-xp /usr/lib64/ld-2.25.so
  445342677873174 0x270 [0x60]: PERF_RECORD_MMAP2 23568/23568: [0x7ffc98176000(0x2000) @ 0 00:00 0 0]: r-xp [vdso]
  445342677891928 0x2d0 [0x28]: PERF_RECORD_SAMPLE(IP, 0x4002): 23568/23568: 0xffffffff8f84c7e7 period: 1 addr: 0
  $

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/20171117214300.32746-3-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b92d6d67..e304bc4 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -793,6 +793,21 @@ static int record__synthesize(struct record *rec, bool tail)
 	if (err)
 		goto out;
 
+	err = perf_event__synthesize_thread_map2(&rec->tool, rec->evlist->threads,
+						 process_synthesized_event,
+						NULL);
+	if (err < 0) {
+		pr_err("Couldn't synthesize thread map.\n");
+		return err;
+	}
+
+	err = perf_event__synthesize_cpu_map(&rec->tool, rec->evlist->cpus,
+					     process_synthesized_event, NULL);
+	if (err < 0) {
+		pr_err("Couldn't synthesize cpu map.\n");
+		return err;
+	}
+
 	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
 					    process_synthesized_event, opts->sample_address,
 					    opts->proc_map_timeout, 1);

  reply	other threads:[~2017-12-06 16:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-17 21:42 Add fine grained sampled metrics for perf script Andi Kleen
2017-11-17 21:42 ` [PATCH v3 1/3] perf, tools, record: Synthesize unit/scale/... in event update Andi Kleen
2017-12-06 16:31   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2017-11-17 21:42 ` [PATCH v3 2/3] perf, tools, record: Synthesize thread map and cpu map Andi Kleen
2017-12-06 16:32   ` tip-bot for Andi Kleen [this message]
2017-11-17 21:43 ` [PATCH v3 3/3] perf, tools, script: Allow computing metrics in perf script Andi Kleen
2017-11-20  9:04   ` Jiri Olsa
2017-11-20 15:35     ` Andi Kleen
2017-11-20 15:53       ` Jiri Olsa
2017-11-20 16:03         ` Andi Kleen
2017-11-21  9:28           ` Jiri Olsa
2017-11-21 17:07             ` Andi Kleen
2017-11-21 21:28               ` Jiri Olsa
2017-12-06 16:32   ` [tip:perf/core] perf script: Allow computing 'perf stat' style metrics tip-bot for Andi Kleen
2017-11-23  7:47 ` Add fine grained sampled metrics for perf script Jiri Olsa
2017-11-23 17:46   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly 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=tip-373565d285e8d2113f1b6c0a2e461b9c8d0da1c9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.