public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / 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 1/8] perf tools: Add thread_map__has function
Date: Tue, 12 Apr 2016 15:29:24 +0200	[thread overview]
Message-ID: <1460467771-26532-2-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1460467771-26532-1-git-send-email-jolsa@kernel.org>

Adding thread_map__has function to return bool
of pid presence in threads map.

Link: http://lkml.kernel.org/n/tip-f3ilapuk59z22pi7qs7b0qw9@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/thread_map.c | 12 ++++++++++++
 tools/perf/util/thread_map.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 267112b4e3db..878ac0687b0a 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -436,3 +436,15 @@ struct thread_map *thread_map__new_event(struct thread_map_event *event)
 
 	return threads;
 }
+
+bool thread_map__has(struct thread_map *threads, pid_t pid)
+{
+	int i;
+
+	for (i = 0; i < threads->nr; ++i) {
+		if (threads->map[i].pid == pid)
+			return true;
+	}
+
+	return false;
+}
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 85e4c7c4fbde..9a065ea69ff1 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -55,4 +55,5 @@ static inline char *thread_map__comm(struct thread_map *map, int thread)
 }
 
 void thread_map__read_comms(struct thread_map *threads);
+bool thread_map__has(struct thread_map *threads, pid_t pid);
 #endif	/* __PERF_THREAD_MAP_H */
-- 
2.4.11

  reply	other threads:[~2016-04-12 13:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 13:29 [PATCH 0/8] perf tools: Add sched map changes Jiri Olsa
2016-04-12 13:29 ` Jiri Olsa [this message]
2016-04-14  5:43   ` [tip:perf/core] perf thread_map: Add has() method tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 2/8] perf tools: Add cpu_map__has function Jiri Olsa
2016-04-14  5:43   ` [tip:perf/core] perf cpu_map: Add has() method tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 3/8] perf tools sched: Add compact display option Jiri Olsa
2016-04-12 14:09   ` Arnaldo Carvalho de Melo
2016-04-12 14:18     ` Arnaldo Carvalho de Melo
2016-04-14  5:44   ` [tip:perf/core] perf " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 4/8] perf tools sched: Use color_fprintf for output Jiri Olsa
2016-04-14  5:44   ` [tip:perf/core] perf " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 5/8] perf tools sched: Make thread_map__new_by_tid_str global Jiri Olsa
2016-04-14  5:44   ` [tip:perf/core] perf thread_map: Make new_by_tid_str constructor public tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 6/8] perf tools sched: Collor given pids Jiri Olsa
2016-04-14  5:45   ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 7/8] perf tools sched: Collor given cpus Jiri Olsa
2016-04-14  5:45   ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 8/8] perf tools sched: Display only " Jiri Olsa
2016-04-14  5:46   ` [tip:perf/core] perf sched map: " tip-bot for Jiri Olsa
2016-04-12 14:38 ` [PATCH 0/8] perf tools: Add sched map changes 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=1460467771-26532-2-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
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