diff options
author | Matt Helsley <matthltc@us.ibm.com> | 2005-12-12 03:37:10 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-12 11:57:42 -0500 |
commit | 5650b736ad328f7f3e4120e8790940289b8ac144 (patch) | |
tree | fb2287d21b6f826f3e291892c3d5c6e640a13c45 | |
parent | 64123fd42c7a1e4ebf6acd2399c98caddc7e0c26 (diff) |
[PATCH] Add timestamp field to process events
This adds a timestamp field to the events sent via the process event
connector. The timestamp allows listeners to accurately account the
duration(s) between a process' events and offers strong means with which
to determine the order of events with respect to a given task while also
avoiding the addition of per-task data.
This alters the size and layout of the event structure and hence would
break compatibility if process events connector as it stands in 2.6.15-rc2
were released as a mainline kernel.
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/connector/cn_proc.c | 5 | ||||
-rw-r--r-- | include/linux/cn_proc.h | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index fcdf0fff13a6..969d2b4aaec0 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -56,6 +56,7 @@ void proc_fork_connector(struct task_struct *task) | |||
56 | msg = (struct cn_msg*)buffer; | 56 | msg = (struct cn_msg*)buffer; |
57 | ev = (struct proc_event*)msg->data; | 57 | ev = (struct proc_event*)msg->data; |
58 | get_seq(&msg->seq, &ev->cpu); | 58 | get_seq(&msg->seq, &ev->cpu); |
59 | getnstimestamp(&ev->timestamp); | ||
59 | ev->what = PROC_EVENT_FORK; | 60 | ev->what = PROC_EVENT_FORK; |
60 | ev->event_data.fork.parent_pid = task->real_parent->pid; | 61 | ev->event_data.fork.parent_pid = task->real_parent->pid; |
61 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; | 62 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; |
@@ -81,6 +82,7 @@ void proc_exec_connector(struct task_struct *task) | |||
81 | msg = (struct cn_msg*)buffer; | 82 | msg = (struct cn_msg*)buffer; |
82 | ev = (struct proc_event*)msg->data; | 83 | ev = (struct proc_event*)msg->data; |
83 | get_seq(&msg->seq, &ev->cpu); | 84 | get_seq(&msg->seq, &ev->cpu); |
85 | getnstimestamp(&ev->timestamp); | ||
84 | ev->what = PROC_EVENT_EXEC; | 86 | ev->what = PROC_EVENT_EXEC; |
85 | ev->event_data.exec.process_pid = task->pid; | 87 | ev->event_data.exec.process_pid = task->pid; |
86 | ev->event_data.exec.process_tgid = task->tgid; | 88 | ev->event_data.exec.process_tgid = task->tgid; |
@@ -114,6 +116,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
114 | } else | 116 | } else |
115 | return; | 117 | return; |
116 | get_seq(&msg->seq, &ev->cpu); | 118 | get_seq(&msg->seq, &ev->cpu); |
119 | getnstimestamp(&ev->timestamp); | ||
117 | 120 | ||
118 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 121 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
119 | msg->ack = 0; /* not used */ | 122 | msg->ack = 0; /* not used */ |
@@ -133,6 +136,7 @@ void proc_exit_connector(struct task_struct *task) | |||
133 | msg = (struct cn_msg*)buffer; | 136 | msg = (struct cn_msg*)buffer; |
134 | ev = (struct proc_event*)msg->data; | 137 | ev = (struct proc_event*)msg->data; |
135 | get_seq(&msg->seq, &ev->cpu); | 138 | get_seq(&msg->seq, &ev->cpu); |
139 | getnstimestamp(&ev->timestamp); | ||
136 | ev->what = PROC_EVENT_EXIT; | 140 | ev->what = PROC_EVENT_EXIT; |
137 | ev->event_data.exit.process_pid = task->pid; | 141 | ev->event_data.exit.process_pid = task->pid; |
138 | ev->event_data.exit.process_tgid = task->tgid; | 142 | ev->event_data.exit.process_tgid = task->tgid; |
@@ -165,6 +169,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
165 | msg = (struct cn_msg*)buffer; | 169 | msg = (struct cn_msg*)buffer; |
166 | ev = (struct proc_event*)msg->data; | 170 | ev = (struct proc_event*)msg->data; |
167 | msg->seq = rcvd_seq; | 171 | msg->seq = rcvd_seq; |
172 | getnstimestamp(&ev->timestamp); | ||
168 | ev->cpu = -1; | 173 | ev->cpu = -1; |
169 | ev->what = PROC_EVENT_NONE; | 174 | ev->what = PROC_EVENT_NONE; |
170 | ev->event_data.ack.err = err; | 175 | ev->event_data.ack.err = err; |
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h index c948f678e04e..1417de935057 100644 --- a/include/linux/cn_proc.h +++ b/include/linux/cn_proc.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define CN_PROC_H | 26 | #define CN_PROC_H |
27 | 27 | ||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/time.h> | ||
29 | #include <linux/connector.h> | 30 | #include <linux/connector.h> |
30 | 31 | ||
31 | /* | 32 | /* |
@@ -65,6 +66,7 @@ struct proc_event { | |||
65 | PROC_EVENT_EXIT = 0x80000000 | 66 | PROC_EVENT_EXIT = 0x80000000 |
66 | } what; | 67 | } what; |
67 | __u32 cpu; | 68 | __u32 cpu; |
69 | struct timespec timestamp; | ||
68 | union { /* must be last field of proc_event struct */ | 70 | union { /* must be last field of proc_event struct */ |
69 | struct { | 71 | struct { |
70 | __u32 err; | 72 | __u32 err; |