Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1376800

[PATCH 1/8] perf tools: Add thread_map__has function

From Jiri Olsa <jolsa@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 1/8] perf tools: Add thread_map__has function
Date 2016-04-12 15:30 +0200
Message-ID <rn6ye-83Y-25@gated-at.bofh.it> (permalink)
References <rn6ye-83Y-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] perf tools: Add sched map changes Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
  [PATCH 2/8] perf tools: Add cpu_map__has function Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
    [tip:perf/core] perf cpu_map: Add has() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 1/8] perf tools: Add thread_map__has function Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
    [tip:perf/core] perf thread_map: Add has() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 6/8] perf tools sched: Collor given pids Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    [tip:perf/core] perf sched map: Color given pids tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 7/8] perf tools sched: Collor given cpus Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    [tip:perf/core] perf sched map: Color given cpus tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 4/8] perf tools sched: Use color_fprintf for output Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    [tip:perf/core] perf sched: Use color_fprintf for output tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 8/8] perf tools sched: Display only given cpus Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    [tip:perf/core] perf sched map: Display only given cpus tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 5/8] perf tools sched: Make thread_map__new_by_tid_str global Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    [tip:perf/core] perf thread_map: Make new_by_tid_str constructor  public tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  [PATCH 3/8] perf tools sched: Add compact display option Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
    Re: [PATCH 3/8] perf tools sched: Add compact display option Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:20 +0200
    Re: [PATCH 3/8] perf tools sched: Add compact display option Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:20 +0200
    [tip:perf/core] perf sched: Add compact display option tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
  Re: [PATCH 0/8] perf tools: Add sched map changes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:40 +0200

csiph-web