Skip to contentSkip to conversation

sched_process_exec

DISCUSSION Mathieu Desnoyers 2 participants 5 messages Oct 11, 2012 – Oct 12, 2012 5 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines · * Woegerer, Paul ([email protected]) wrote:

Hi,

Is there a reason why instrumentation/events/lttng-module/sched.h does not include TRACE_EVENT(sched_process_exec) ?

The patch below adds the missing tracepoint definition (tested with kernel 3.4.6-2.10).

Hi Paul,

The only reason is because it appeared in a later kernel than the one used when generating the lttng-modules trace event instrumentation.

A couple a details to fix before I can merge this patch though:

Please also update instrumentation/events/mainline/sched.h to add the original mainline TRACE_EVENT, so we can keep the files in sync.

Quoted 17 lines
instrumentation/events/lttng-module/sched.h +7 -0
index b68616e..ef791ac 100644
@@ -314,6 +314,32 @@ TRACE_EVENT(sched_process_fork,
 )
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+       TP_PROTO(struct task_struct *p, pid_t old_pid,
+                struct linux_binprm *bprm),
+

instrumentation/events/lttng-module/sched.h TRACE_EVENT(sched_process_fork, · line 333

Quoted 10 lines
instrumentation/events/lttng-module/sched.h +10 -0
+       TP_ARGS(p, old_pid, bprm),
+
+       TP_STRUCT__entry(
+               __string(       filename,       bprm->filename  )
+               __field(        pid_t,          pid             )
+               __field(        pid_t,          old_pid         )
+       ),
+
+       TP_fast_assign(
+               tp_strcpy(filename, bprm->filename);

Please remove the ";" above.

Quoted 11 lines
instrumentation/events/lttng-module/sched.h +9 -0
+               tp_assign(pid, p->pid)
+               tp_assign(old_pid, old_pid)
+       ),
+
+       TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+                 __entry->pid, __entry->old_pid)
+)
+
+/*
  * XXX the below sched_stat tracepoints only apply to  

SCHED_OTHER/BATCH/IDLE

A newline has been added by your mail client, which causes the patch to not apply correctly.

Hints on how to configure mail clients for sending patches can be looked up in the Linux kernel tree, under Documentation/email-clients.txt

Thanks!

Mathieu

Quoted 18 lines

* adding sched_stat support to SCHED_FIFO/RR would be welcome.
*/

Signature · 14 lines
Paul Woegerer | SW Development Engineer
http://go.mentor.com/sourceryanalyzer

Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.


_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#3 lore raw
In reply to a message not in the archive
Quoted 4 lines · Mathieu Desnoyers

A couple a details to fix before I can merge this patch though:

Please also update instrumentation/events/mainline/sched.h to add the original mainline TRACE_EVENT, so we can keep the files in sync.

Ok, reconfigured Thunderbird, removed semicolon, updated mainline:

(quoted diff) +0 -0

b/instrumentation/events/lttng-module/sched.h
index b68616e..23e4955 100644

instrumentation/events/lttng-module/sched.h +26 -0
@@ -314,6 +314,32 @@ TRACE_EVENT(sched_process_fork,
 )
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		tp_strcpy(filename, bprm->filename)
+		tp_assign(pid, p->pid)
+		tp_assign(old_pid, old_pid)
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+)
+
+/*
  * XXX the below sched_stat tracepoints only apply to

SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
*/

(quoted diff) +0 -0

b/instrumentation/events/mainline/sched.h
index f633478..6700ecc 100644

instrumentation/events/mainline/sched.h +26 -0
@@ -275,6 +275,32 @@ TRACE_EVENT(sched_process_fork,
 );
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		__assign_str(filename, bprm->filename);
+		__entry->pid		= p->pid;
+		__entry->old_pid	= old_pid;
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+);
+
+/*
  * XXX the below sched_stat tracepoints only apply to

SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
*/

#5 lore raw
In reply to a message not in the archive
Quoted 7 lines · * Woegerer, Paul ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

A couple a details to fix before I can merge this patch though:

Please also update instrumentation/events/mainline/sched.h to add the original mainline TRACE_EVENT, so we can keep the files in sync.

Ok, reconfigured Thunderbird, removed semicolon, updated mainline:

Still an issue:

compudj@thinkos:~/work/lttng-modules$ patch -p1 < ~/.swp
patching file instrumentation/events/lttng-module/sched.h
patch: **** malformed patch at line 45: SCHED_OTHER/BATCH/IDLE

it seems to be an issue with line-wrapping of your mail client.

Thanks,

Mathieu

Quoted 80 lines
instrumentation/events/lttng-module/sched.h +26 -0
index b68616e..23e4955 100644
@@ -314,6 +314,32 @@ TRACE_EVENT(sched_process_fork,
 )
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		tp_strcpy(filename, bprm->filename)
+		tp_assign(pid, p->pid)
+		tp_assign(old_pid, old_pid)
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+)
+
+/*
  * XXX the below sched_stat tracepoints only apply to

SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
*/

instrumentation/events/mainline/sched.h +26 -0
index f633478..6700ecc 100644
@@ -275,6 +275,32 @@ TRACE_EVENT(sched_process_fork,
 );
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		__assign_str(filename, bprm->filename);
+		__entry->pid		= p->pid;
+		__entry->old_pid	= old_pid;
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+);
+
+/*
  * XXX the below sched_stat tracepoints only apply to

SCHED_OTHER/BATCH/IDLE
* adding sched_stat support to SCHED_FIFO/RR would be welcome.
*/

Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
#7 lore raw
In reply to a message not in the archive
Quoted 7 lines · Mathieu Desnoyers
Quoted 6 lines · * Woegerer, Paul ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

A couple a details to fix before I can merge this patch though:

Please also update instrumentation/events/mainline/sched.h to add the original mainline TRACE_EVENT, so we can keep the files in sync.

Quoted 7 lines
Quoted 1 line

Ok, reconfigured Thunderbird, removed semicolon, updated mainline:

Still an issue:

compudj@thinkos:~/work/lttng-modules$ patch -p1 < ~/.swp
patching file instrumentation/events/lttng-module/sched.h
patch: **** malformed patch at line 45: SCHED_OTHER/BATCH/IDLE

Now it should (hopefully) work:

From b792323bca694f1e88144319befcdbfb30efa878 Mon Sep 17 00:00:00 2001
From: Paul Woegerer <[email protected]>
Date: Fri, 12 Oct 2012 12:52:19 +0200
Subject: [PATCH] Add TRACE_EVENT(sched_process_exec) to sched.h.

---
 instrumentation/events/lttng-module/sched.h |   26 ++++++++++++++++++++++++++
 instrumentation/events/mainline/sched.h     |   26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
instrumentation/events/lttng-module/sched.h +26 -0
index b68616e..23e4955 100644
@@ -314,6 +314,32 @@ TRACE_EVENT(sched_process_fork,
 )
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		tp_strcpy(filename, bprm->filename)
+		tp_assign(pid, p->pid)
+		tp_assign(old_pid, old_pid)
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+)
+
+/*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
instrumentation/events/mainline/sched.h +26 -0
index f633478..6700ecc 100644
@@ -275,6 +275,32 @@ TRACE_EVENT(sched_process_fork,
 );
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		__assign_str(filename, bprm->filename);
+		__entry->pid		= p->pid;
+		__entry->old_pid	= old_pid;
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+);
+
+/*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
Signature · 1 line
1.7.10.4
author Applied
#9 lore raw
In reply to a message not in the archive
Quoted 16 lines · * Woegerer, Paul ([email protected]) wrote:
Quoted 7 lines · Mathieu Desnoyers
Quoted 6 lines · * Woegerer, Paul ([email protected]) wrote:
Quoted 4 lines · Mathieu Desnoyers

A couple a details to fix before I can merge this patch though:

Please also update instrumentation/events/mainline/sched.h to add the original mainline TRACE_EVENT, so we can keep the files in sync.

Quoted 7 lines
Quoted 1 line

Ok, reconfigured Thunderbird, removed semicolon, updated mainline:

Still an issue:

compudj@thinkos:~/work/lttng-modules$ patch -p1 < ~/.swp
patching file instrumentation/events/lttng-module/sched.h
patch: **** malformed patch at line 45: SCHED_OTHER/BATCH/IDLE
Quoted 6 lines

Now it should (hopefully) work:

From b792323bca694f1e88144319befcdbfb30efa878 Mon Sep 17 00:00:00 2001
From: Paul Woegerer <[email protected]>
Date: Fri, 12 Oct 2012 12:52:19 +0200
Subject: [PATCH] Add TRACE_EVENT(sched_process_exec) to sched.h.

merged, thanks !

Mathieu

Quoted 83 lines
---
 instrumentation/events/lttng-module/sched.h |   26 ++++++++++++++++++++++++++
 instrumentation/events/mainline/sched.h     |   26 ++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
instrumentation/events/lttng-module/sched.h +26 -0
index b68616e..23e4955 100644
@@ -314,6 +314,32 @@ TRACE_EVENT(sched_process_fork,
 )
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		tp_strcpy(filename, bprm->filename)
+		tp_assign(pid, p->pid)
+		tp_assign(old_pid, old_pid)
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+)
+
+/*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
instrumentation/events/mainline/sched.h +26 -0
index f633478..6700ecc 100644
@@ -275,6 +275,32 @@ TRACE_EVENT(sched_process_fork,
 );
 
 /*
+ * Tracepoint for exec:
+ */
+TRACE_EVENT(sched_process_exec,
+
+	TP_PROTO(struct task_struct *p, pid_t old_pid,
+		 struct linux_binprm *bprm),
+
+	TP_ARGS(p, old_pid, bprm),
+
+	TP_STRUCT__entry(
+		__string(	filename,	bprm->filename	)
+		__field(	pid_t,		pid		)
+		__field(	pid_t,		old_pid		)
+	),
+
+	TP_fast_assign(
+		__assign_str(filename, bprm->filename);
+		__entry->pid		= p->pid;
+		__entry->old_pid	= old_pid;
+	),
+
+	TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
+		  __entry->pid, __entry->old_pid)
+);
+
+/*
  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
  */
Signature · 1 line
1.7.10.4
Signature · 4 lines
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com