public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] OProfile: Export task->tgid in the buffer
Date: Thu, 12 Jun 2003 03:02:30 +0100	[thread overview]
Message-ID: <10553833504038@movementarian.org> (raw)
In-Reply-To: 


Export the task->tgid to userspace as well. This is needed
for forthcoming thread profiling stuff and should have been
done in the original patch ... oh well.

This requires an upgrade to oprofile 0.5.3. You can get it from
the website, or, for the impatient, here :

http://movementarian.org/oprofile-0.5.3.tar.gz

diff -Naur -X dontdiff linux-cvs/drivers/oprofile/buffer_sync.c linux-fixes/drivers/oprofile/buffer_sync.c
--- linux-cvs/drivers/oprofile/buffer_sync.c	2003-05-26 05:42:35.000000000 +0100
+++ linux-fixes/drivers/oprofile/buffer_sync.c	2003-06-12 02:05:19.000000000 +0100
@@ -274,12 +272,17 @@
 		add_event_entry(KERNEL_EXIT_SWITCH_CODE); 
 }
  
-static void add_user_ctx_switch(pid_t pid, unsigned long cookie)
+static void
+add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
 {
 	add_event_entry(ESCAPE_CODE);
 	add_event_entry(CTX_SWITCH_CODE); 
-	add_event_entry(pid);
+	add_event_entry(task->pid);
 	add_event_entry(cookie);
+	/* Another code for daemon back-compat */
+	add_event_entry(ESCAPE_CODE);
+	add_event_entry(CTX_TGID_CODE);
+	add_event_entry(task->tgid);
 }
 
  
@@ -446,7 +449,7 @@
 				mm = take_tasks_mm(new);
 
 				cookie = get_exec_dcookie(mm);
-				add_user_ctx_switch(new->pid, cookie);
+				add_user_ctx_switch(new, cookie);
 			}
 		} else {
 			add_sample(mm, s, in_kernel);
diff -Naur -X dontdiff linux-cvs/drivers/oprofile/event_buffer.h linux-fixes/drivers/oprofile/event_buffer.h
--- linux-cvs/drivers/oprofile/event_buffer.h	2003-04-02 06:06:51.000000000 +0100
+++ linux-fixes/drivers/oprofile/event_buffer.h	2003-06-12 02:04:05.000000000 +0100
@@ -31,6 +31,7 @@
 #define KERNEL_ENTER_SWITCH_CODE	4
 #define KERNEL_EXIT_SWITCH_CODE		5
 #define MODULE_LOADED_CODE		6
+#define CTX_TGID_CODE			7
  
 /* add data to the event buffer */
 void add_event_entry(unsigned long data);


             reply	other threads:[~2003-06-12  1:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-12  2:02 John Levon [this message]
2003-06-12  2:02 ` [PATCH 2/4] OProfile: update Changes John Levon
2003-06-12  2:02   ` [PATCH 3/4] OProfile: remove useless code John Levon
2003-06-12  2:02     ` [PATCH 4/4] OProfile: fix init / exit routine John Levon

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=10553833504038@movementarian.org \
    --to=levon@movementarian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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