From: Arjan van de Ven <arjan@linux.intel.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: perf: add a timestamp to exit and fork events
Date: Sun, 09 Aug 2009 14:46:49 -0700 [thread overview]
Message-ID: <4A7F43C9.8070207@linux.intel.com> (raw)
In order to make use of the fork and exit perf events, it's essential that they tell the
user about when these event happened. This patch adds a time field to the end of the structure
(and thus is abi compatible).
I did not make this field conditional on any flag since that both is unpleasant to use,
and I cannot imagine a scenario where you want the event but not the time.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 0a6f320..5e0769a 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -315,6 +315,7 @@ enum perf_event_type {
* struct perf_event_header header;
* u32 pid, ppid;
* u32 tid, ptid;
+ * u64 time;
* };
*/
PERF_EVENT_EXIT = 4,
@@ -335,6 +336,7 @@ enum perf_event_type {
* struct perf_event_header header;
* u32 pid, ppid;
* u32 tid, ptid;
+ * u64 time;
* };
*/
PERF_EVENT_FORK = 7,
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index bf8110b..9382cd0 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -2861,6 +2861,7 @@ struct perf_task_event {
u32 ppid;
u32 tid;
u32 ptid;
+ u64 time;
} event;
};
@@ -2881,6 +2885,7 @@ static void perf_counter_task_output(struct perf_counter *counter,
task_event->event.tid = perf_counter_tid(counter, task);
task_event->event.ptid = perf_counter_tid(counter, task->real_parent);
+ task_event->event.time = sched_clock();
perf_output_put(&handle, task_event->event);
perf_output_end(&handle);
}
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 1dba568..c28e2b3 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -72,6 +72,8 @@ struct comm_event {
struct fork_event {
struct perf_event_header header;
u32 pid, ppid;
+ u32 tid, ptid;
+ u64 time;
};
typedef union event_union {
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 4163918..1cb2183 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -104,6 +104,7 @@ struct fork_event {
struct perf_event_header header;
u32 pid, ppid;
u32 tid, ptid;
+ u64 time;
};
struct lost_event {
reply other threads:[~2009-08-09 21:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4A7F43C9.8070207@linux.intel.com \
--to=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Powered by JetHome