mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
To: linux-kernel@vger.kernel.org
Cc: dsahern@gmail.com, adrian.hunter@intel.com, jolsa@redhat.com,
	namhyung@kernel.org, acme@ghostprotocols.net, mingo@redhat.com,
	Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Subject: [PATCH] perf util: Join four conditions in two in perf_evlist__create_maps().
Date: Wed, 27 Nov 2013 17:23:04 -0500	[thread overview]
Message-ID: <1385590984-30244-1-git-send-email-yangds.fnst@cn.fujitsu.com> (raw)

There are four condition branchs in perf_evlist__create_maps, but they
only do two kinds of thing. 1st and 4th call cpu_map__new(), and the others
call cpu_map__dummy_new(). This patch joins them in two branchs, decreasing
the number of branch and removing some duplicated code.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/util/evlist.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index bbc746a..2258eb4 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -819,11 +819,9 @@ int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
 	if (evlist->threads == NULL)
 		return -1;
 
-	if (target->force_per_cpu)
-		evlist->cpus = cpu_map__new(target->cpu_list);
-	else if (target__has_task(target))
-		evlist->cpus = cpu_map__dummy_new();
-	else if (!target__has_cpu(target) && !target->uses_mmap)
+	if (!target->force_per_cpu &&
+	    (target__has_task(target) || 
+	     (!target__has_cpu(target) && !target->uses_mmap)))
 		evlist->cpus = cpu_map__dummy_new();
 	else
 		evlist->cpus = cpu_map__new(target->cpu_list);
-- 
1.8.2.1


             reply	other threads:[~2013-11-27  9:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 22:23 Dongsheng Yang [this message]
2013-11-27  9:43 ` Adrian Hunter
2013-11-27 22:52   ` Dongsheng Yang
2013-11-27 10:49     ` Adrian Hunter
2013-11-28  0:36       ` Dongsheng Yang

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=1385590984-30244-1-git-send-email-yangds.fnst@cn.fujitsu.com \
    --to=yangds.fnst@cn.fujitsu.com \
    --cc=acme@ghostprotocols.net \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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
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

all inboxes | Powered by JetHome®