[sysprof] Better handling of events without stacktraces



commit 6dabcefec5e4f82cb7aea81744dc3a509a93c699
Author: Søren Sandmann Pedersen <ssp redhat com>
Date:   Tue Sep 8 02:59:04 2009 -0400

    Better handling of events without stacktraces

 TODO        |    2 ++
 collector.c |   24 +++++++++++++++++++++---
 tracker.c   |    2 --
 3 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/TODO b/TODO
index f83a6b9..4733b9d 100644
--- a/TODO
+++ b/TODO
@@ -23,6 +23,8 @@ Before 1.0.4:
 
 Before 1.2:
 
+* Hack around gtk+ bug where it mispositions the window.
+
 * Counters must not be destroyed during tracker setup. They have to exist
   but be disabled so that we can track creation of processes.
 
diff --git a/collector.c b/collector.c
index 0dba01c..d428007 100644
--- a/collector.c
+++ b/collector.c
@@ -237,7 +237,7 @@ on_read (gpointer data)
     skip_samples = in_dead_period (collector);
     
     while (head - tail >= sizeof (struct perf_event_header))
-    {
+    {	
 	struct perf_event_header *header = (void *)(counter->data + (tail & mask));
 
 	if (header->size > head - tail)
@@ -473,10 +473,28 @@ process_sample (Collector      *collector,
 {
     uint64_t *ips;
     int n_ips;
+
     if (sample->n_ips == 0)
     {
-	ips = &sample->ip;
-	n_ips = 1;
+	uint64_t trace[3];
+
+	if (sample->header.misc & PERF_EVENT_MISC_KERNEL)
+	{
+	    trace[0] = PERF_CONTEXT_KERNEL;
+	    trace[1] = sample->ip;
+	    trace[2] = PERF_CONTEXT_USER;
+
+	    ips = trace;
+	    n_ips = 3;
+	}
+	else
+	{
+	    trace[0] = PERF_CONTEXT_USER;
+	    trace[1] = sample->ip;
+
+	    ips = trace;
+	    n_ips = 2;
+	}
     }
     else
     {
diff --git a/tracker.c b/tracker.c
index 2b93318..7f59f3e 100644
--- a/tracker.c
+++ b/tracker.c
@@ -295,8 +295,6 @@ tracker_add_process (tracker_t * tracker,
     COPY_STRING (event.command_line, command_line);
     
     tracker_append (tracker, &event, sizeof (event));
-    
-    g_print ("Added new process: %d (%s)\n", pid, command_line);
 }
 
 void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]