linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Jiri Olsa <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, a.p.zijlstra@chello.nl, namhyung@kernel.org,
	dsahern@gmail.com, acme@redhat.com, linux-kernel@vger.kernel.org,
	jolsa@kernel.org, hpa@zytor.com, mingo@kernel.org
Subject: [tip:perf/urgent] perf evsel: Use variable instead of repeating lengthy FD macro
Date: Tue, 20 Dec 2016 11:23:36 -0800	[thread overview]
Message-ID: <tip-83c2e4f3968d6871eed295f2f5675d3d70b01afa@git.kernel.org> (raw)
In-Reply-To: <1481538943-21874-3-git-send-email-jolsa@kernel.org>

Commit-ID:  83c2e4f3968d6871eed295f2f5675d3d70b01afa
Gitweb:     http://git.kernel.org/tip/83c2e4f3968d6871eed295f2f5675d3d70b01afa
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Mon, 12 Dec 2016 11:35:40 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 15 Dec 2016 16:25:45 -0300

perf evsel: Use variable instead of repeating lengthy FD macro

It's more readable and will ease up following patches.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481538943-21874-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index b2365a63..fd61ebd 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1474,7 +1474,7 @@ retry_sample_id:
 	for (cpu = 0; cpu < cpus->nr; cpu++) {
 
 		for (thread = 0; thread < nthreads; thread++) {
-			int group_fd;
+			int fd, group_fd;
 
 			if (!evsel->cgrp && !evsel->system_wide)
 				pid = thread_map__pid(threads, thread);
@@ -1484,21 +1484,22 @@ retry_open:
 			pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx",
 				  pid, cpus->map[cpu], group_fd, flags);
 
-			FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
-								     pid,
-								     cpus->map[cpu],
-								     group_fd, flags);
-			if (FD(evsel, cpu, thread) < 0) {
+			fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
+						 group_fd, flags);
+
+			FD(evsel, cpu, thread) = fd;
+
+			if (fd < 0) {
 				err = -errno;
 				pr_debug2("\nsys_perf_event_open failed, error %d\n",
 					  err);
 				goto try_fallback;
 			}
 
-			pr_debug2(" = %d\n", FD(evsel, cpu, thread));
+			pr_debug2(" = %d\n", fd);
 
 			if (evsel->bpf_fd >= 0) {
-				int evt_fd = FD(evsel, cpu, thread);
+				int evt_fd = fd;
 				int bpf_fd = evsel->bpf_fd;
 
 				err = ioctl(evt_fd,

  reply	other threads:[~2016-12-20 19:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 10:35 [PATCH 0/5] perf record: Allow to ignore missing pid Jiri Olsa
2016-12-12 10:35 ` [PATCH 1/5] perf mem: Fix --all-user/--all-kernel options Jiri Olsa
2016-12-12 13:43   ` Arnaldo Carvalho de Melo
2016-12-12 13:44     ` Jiri Olsa
2016-12-20 19:23   ` [tip:perf/urgent] " tip-bot for Jiri Olsa
2016-12-12 10:35 ` [PATCH 2/5] perf tools: Use variable instead of repeating lengthy FD macro Jiri Olsa
2016-12-20 19:23   ` tip-bot for Jiri Olsa [this message]
2016-12-12 10:35 ` [PATCH 3/5] perf tools: Add thread_map__remove function Jiri Olsa
2016-12-12 20:08   ` Arnaldo Carvalho de Melo
2016-12-12 20:21     ` Arnaldo Carvalho de Melo
2016-12-20 19:24   ` [tip:perf/urgent] perf thread_map: " tip-bot for Jiri Olsa
2016-12-12 10:35 ` [PATCH 4/5] perf tools: Allow to ignore missing pid Jiri Olsa
2016-12-12 14:32   ` Arnaldo Carvalho de Melo
2016-12-12 14:33     ` Arnaldo Carvalho de Melo
2016-12-12 14:53     ` Jiri Olsa
2016-12-12 15:21       ` Arnaldo Carvalho de Melo
2016-12-12 15:38         ` Jiri Olsa
2016-12-12 19:30           ` Arnaldo Carvalho de Melo
2016-12-12 16:58   ` Namhyung Kim
2016-12-13  7:46     ` [PATCHv2 " Jiri Olsa
2016-12-20 19:24       ` [tip:perf/urgent] perf evsel: " tip-bot for Jiri Olsa
2016-12-12 10:35 ` [PATCH 5/5] perf record: Force ignore_missing_thread for uid option Jiri Olsa
2016-12-20 19:25   ` [tip:perf/urgent] " tip-bot for Jiri Olsa

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-83c2e4f3968d6871eed295f2f5675d3d70b01afa@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.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=namhyung@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 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).