Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966737AbbLRJKQ (ORCPT ); Fri, 18 Dec 2015 04:10:16 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52468 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753321AbbLRJKI (ORCPT ); Fri, 18 Dec 2015 04:10:08 -0500 Date: Fri, 18 Dec 2015 01:09:52 -0800 From: tip-bot for Jiri Olsa Message-ID: Cc: a.p.zijlstra@chello.nl, tglx@linutronix.de, kan.liang@intel.com, jolsa@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, mingo@kernel.org, hpa@zytor.com, dsahern@gmail.com Reply-To: a.p.zijlstra@chello.nl, tglx@linutronix.de, jolsa@kernel.org, kan.liang@intel.com, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org, mingo@kernel.org, hpa@zytor.com, dsahern@gmail.com In-Reply-To: <1446734469-11352-6-git-send-email-jolsa@kernel.org> References: <1446734469-11352-6-git-send-email-jolsa@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat record: Store events IDs in perf data file Git-Commit-ID: 2af4646d1041ee590b0032d2b0103fa81aa43174 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2537 Lines: 80 Commit-ID: 2af4646d1041ee590b0032d2b0103fa81aa43174 Gitweb: http://git.kernel.org/tip/2af4646d1041ee590b0032d2b0103fa81aa43174 Author: Jiri Olsa AuthorDate: Thu, 5 Nov 2015 15:40:49 +0100 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 17 Dec 2015 15:15:21 -0300 perf stat record: Store events IDs in perf data file Store event IDs in evlist object so it get stored into perf.data file. Signed-off-by: Jiri Olsa Tested-by: Kan Liang Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1446734469-11352-6-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-stat.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 45bf4d2..39d0c30f 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -346,6 +346,38 @@ static int perf_stat_synthesize_config(void) return 0; } +#define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) + +static int __store_counter_ids(struct perf_evsel *counter, + struct cpu_map *cpus, + struct thread_map *threads) +{ + int cpu, thread; + + for (cpu = 0; cpu < cpus->nr; cpu++) { + for (thread = 0; thread < threads->nr; thread++) { + int fd = FD(counter, cpu, thread); + + if (perf_evlist__id_add_fd(evsel_list, counter, + cpu, thread, fd) < 0) + return -1; + } + } + + return 0; +} + +static int store_counter_ids(struct perf_evsel *counter) +{ + struct cpu_map *cpus = counter->cpus; + struct thread_map *threads = counter->threads; + + if (perf_evsel__alloc_id(counter, cpus->nr, threads->nr)) + return -ENOMEM; + + return __store_counter_ids(counter, cpus, threads); +} + static int __run_perf_stat(int argc, const char **argv) { int interval = stat_config.interval; @@ -410,6 +442,9 @@ static int __run_perf_stat(int argc, const char **argv) l = strlen(counter->unit); if (l > unit_width) unit_width = l; + + if (STAT_RECORD && store_counter_ids(counter)) + return -1; } if (perf_evlist__apply_filters(evsel_list, &counter)) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/