All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for David Ahern <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	eranian@google.com, hpa@zytor.com, mingo@kernel.org,
	peterz@infradead.org, namhyung@kernel.org, jolsa@redhat.com,
	fweisbec@gmail.com, dsahern@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf sched: Remove sched_process_fork tracepoint
Date: Thu, 15 Aug 2013 00:55:34 -0700	[thread overview]
Message-ID: <tip-cb627505ae028a0cd88cc29ed72a4c168a08751d@git.kernel.org> (raw)
In-Reply-To: <1375930261-77273-6-git-send-email-dsahern@gmail.com>

Commit-ID:  cb627505ae028a0cd88cc29ed72a4c168a08751d
Gitweb:     http://git.kernel.org/tip/cb627505ae028a0cd88cc29ed72a4c168a08751d
Author:     David Ahern <dsahern@gmail.com>
AuthorDate: Wed, 7 Aug 2013 22:50:47 -0400
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 12 Aug 2013 10:31:07 -0300

perf sched: Remove sched_process_fork tracepoint

The PERF_RECORD_FORK event is already collected as part of the use of
cmd_record and those events are analyzed as part of the libperf
machinery.  Using the fork tracepoint as well just duplicates the event
load.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375930261-77273-6-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 60 ++++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 42f4587..f809cc7 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -109,8 +109,9 @@ struct trace_sched_handler {
 	int (*wakeup_event)(struct perf_sched *sched, struct perf_evsel *evsel,
 			    struct perf_sample *sample, struct machine *machine);
 
-	int (*fork_event)(struct perf_sched *sched, struct perf_evsel *evsel,
-			  struct perf_sample *sample);
+	/* PERF_RECORD_FORK event, not sched_process_fork tracepoint */
+	int (*fork_event)(struct perf_sched *sched, union perf_event *event,
+			  struct machine *machine);
 
 	int (*migrate_task_event)(struct perf_sched *sched,
 				  struct perf_evsel *evsel,
@@ -717,22 +718,29 @@ static int replay_switch_event(struct perf_sched *sched,
 	return 0;
 }
 
-static int replay_fork_event(struct perf_sched *sched, struct perf_evsel *evsel,
-			     struct perf_sample *sample)
+static int replay_fork_event(struct perf_sched *sched,
+			     union perf_event *event,
+			     struct machine *machine)
 {
-	const char *parent_comm = perf_evsel__strval(evsel, sample, "parent_comm"),
-		   *child_comm  = perf_evsel__strval(evsel, sample, "child_comm");
-	const u32 parent_pid  = perf_evsel__intval(evsel, sample, "parent_pid"),
-		  child_pid  = perf_evsel__intval(evsel, sample, "child_pid");
+	struct thread *child, *parent;
+
+	child = machine__findnew_thread(machine, event->fork.tid);
+	parent = machine__findnew_thread(machine, event->fork.ptid);
+
+	if (child == NULL || parent == NULL) {
+		pr_debug("thread does not exist on fork event: child %p, parent %p\n",
+				 child, parent);
+		return 0;
+	}
 
 	if (verbose) {
-		printf("sched_fork event %p\n", evsel);
-		printf("... parent: %s/%d\n", parent_comm, parent_pid);
-		printf("...  child: %s/%d\n", child_comm, child_pid);
+		printf("fork event\n");
+		printf("... parent: %s/%d\n", parent->comm, parent->tid);
+		printf("...  child: %s/%d\n", child->comm, child->tid);
 	}
 
-	register_pid(sched, parent_pid, parent_comm);
-	register_pid(sched, child_pid, child_comm);
+	register_pid(sched, parent->tid, parent->comm);
+	register_pid(sched, child->tid, child->comm);
 	return 0;
 }
 
@@ -824,14 +832,6 @@ static int thread_atoms_insert(struct perf_sched *sched, struct thread *thread)
 	return 0;
 }
 
-static int latency_fork_event(struct perf_sched *sched __maybe_unused,
-			      struct perf_evsel *evsel __maybe_unused,
-			      struct perf_sample *sample __maybe_unused)
-{
-	/* should insert the newcomer */
-	return 0;
-}
-
 static char sched_out_state(u64 prev_state)
 {
 	const char *str = TASK_STATE_TO_CHAR_STR;
@@ -1379,15 +1379,19 @@ static int process_sched_runtime_event(struct perf_tool *tool,
 	return 0;
 }
 
-static int process_sched_fork_event(struct perf_tool *tool,
-				    struct perf_evsel *evsel,
-				    struct perf_sample *sample,
-				    struct machine *machine __maybe_unused)
+static int perf_sched__process_fork_event(struct perf_tool *tool,
+					  union perf_event *event,
+					  struct perf_sample *sample,
+					  struct machine *machine)
 {
 	struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
 
+	/* run the fork event through the perf machineruy */
+	perf_event__process_fork(tool, event, sample, machine);
+
+	/* and then run additional processing needed for this command */
 	if (sched->tp_handler->fork_event)
-		return sched->tp_handler->fork_event(sched, evsel, sample);
+		return sched->tp_handler->fork_event(sched, event, machine);
 
 	return 0;
 }
@@ -1437,7 +1441,6 @@ static int perf_sched__read_events(struct perf_sched *sched,
 		{ "sched:sched_stat_runtime", process_sched_runtime_event, },
 		{ "sched:sched_wakeup",	      process_sched_wakeup_event, },
 		{ "sched:sched_wakeup_new",   process_sched_wakeup_event, },
-		{ "sched:sched_process_fork", process_sched_fork_event, },
 		{ "sched:sched_migrate_task", process_sched_migrate_task_event, },
 	};
 	struct perf_session *session;
@@ -1652,7 +1655,7 @@ static struct perf_sched sched = {
 		.sample		 = perf_sched__process_tracepoint_sample,
 		.comm		 = perf_event__process_comm,
 		.lost		 = perf_event__process_lost,
-		.fork		 = perf_event__process_fork,
+		.fork		 = perf_sched__process_fork_event,
 		.ordered_samples = true,
 	},
 	.cmp_pid	      = LIST_HEAD_INIT(sched.cmp_pid),
@@ -1714,7 +1717,6 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 		.wakeup_event	    = latency_wakeup_event,
 		.switch_event	    = latency_switch_event,
 		.runtime_event	    = latency_runtime_event,
-		.fork_event	    = latency_fork_event,
 		.migrate_task_event = latency_migrate_task_event,
 	};
 	struct trace_sched_handler map_ops  = {

  parent reply	other threads:[~2013-08-15  7:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08  2:50 [PATCH 00/19] perf sched: Add timehist subcommand David Ahern
2013-08-08  2:50 ` [PATCH 01/19] perf: sample after exit loses thread correlation - v3 David Ahern
2013-08-08 14:53   ` Arnaldo Carvalho de Melo
2013-08-08 20:42     ` David Ahern
2013-08-08 21:23       ` Arnaldo Carvalho de Melo
2013-08-08  2:50 ` [PATCH 02/19] perf sched: Simplify arguments to read_events David Ahern
2013-08-08 14:54   ` Arnaldo Carvalho de Melo
2013-08-15  7:55   ` [tip:perf/core] " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 03/19] perf sched: Remove thread lookup in sample handler David Ahern
2013-08-08 14:56   ` Arnaldo Carvalho de Melo
2013-08-15  7:55   ` [tip:perf/core] " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 04/19] perf sched: Remove sched_process_exit tracepoint David Ahern
2013-08-08 14:57   ` Arnaldo Carvalho de Melo
2013-08-15  7:55   ` [tip:perf/core] " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 05/19] perf sched: Remove sched_process_fork tracepoint David Ahern
2013-08-08 15:00   ` Arnaldo Carvalho de Melo
2013-08-15  7:55   ` tip-bot for David Ahern [this message]
2013-08-08  2:50 ` [PATCH 06/19] perf symbol: Add optimization for idle kernel symbols David Ahern
2013-08-08  2:50 ` [PATCH 07/19] perf top: Use new idle_sym check David Ahern
2013-08-08 15:06   ` Arnaldo Carvalho de Melo
2013-08-09  2:49     ` David Ahern
2013-08-09 13:53       ` Arnaldo Carvalho de Melo
2013-08-08  2:50 ` [PATCH 08/19] perf symbol: Save vmlinux or kallsyms path loaded David Ahern
2013-08-08 15:08   ` Arnaldo Carvalho de Melo
2013-08-09  2:51     ` David Ahern
2013-08-08  2:50 ` [PATCH 09/19] perf tool: Simplify options to perf_evsel__print_ip David Ahern
2013-08-08 15:14   ` Arnaldo Carvalho de Melo
2013-08-15  7:55   ` [tip:perf/core] " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 10/19] perf tool: Add option to print stack trace on single line David Ahern
2013-08-15  7:55   ` [tip:perf/core] perf evsel: " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 11/19] perf tool: Add option to limit stack depth in callchain dumps David Ahern
2013-08-15  7:56   ` [tip:perf/core] perf evsel: " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 12/19] perf tool: Add support for exclude symbol list to symbol_conf David Ahern
2013-08-08  2:50 ` [PATCH 13/19] perf tool: Skip symbols in exclude list while printing callchain David Ahern
2013-08-08  2:50 ` [PATCH 14/19] perf sched: pass event to evsel handlers using data element David Ahern
2013-08-08  2:50 ` [PATCH 15/19] perf sched: Add timehist command David Ahern
2013-08-08  2:50 ` [PATCH 16/19] perf tool: Change perf_session__has_traces to actually check for tracepoints David Ahern
2013-08-08 15:16   ` Arnaldo Carvalho de Melo
2013-08-15  7:56   ` [tip:perf/core] perf session: " tip-bot for David Ahern
2013-08-08  2:50 ` [PATCH 17/19] perf sched timehist: Add support for context-switch event David Ahern
2013-08-08  2:51 ` [PATCH 18/19] perf sched timehist: Print all events in verbose mode David Ahern
2013-08-08  2:51 ` [PATCH 19/19] perf sched timehist: Add pid/tid option David Ahern

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-cb627505ae028a0cd88cc29ed72a4c168a08751d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.