[sysprof] Implement tracker_add_sample()



commit 7b75070125af6e2d3ac91e70472df16b052a20ab
Author: Søren Sandmann Pedersen <ssp redhat com>
Date:   Mon Sep 7 15:57:34 2009 -0400

    Implement tracker_add_sample()

 tracker.c |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/tracker.c b/tracker.c
index b5cbfe0..be475cb 100644
--- a/tracker.c
+++ b/tracker.c
@@ -8,6 +8,15 @@ typedef struct new_process_t new_process_t;
 typedef struct new_map_t new_map_t;
 typedef struct sample_t sample_t;
 
+struct tracker_t
+{
+    StackStash *stash;
+    
+    size_t	 n_event_bytes;
+    size_t	 n_allocated_bytes;
+    uint8_t	*events;
+};
+
 typedef enum
 {
     NEW_PROCESS,
@@ -40,13 +49,6 @@ struct sample_t
     StackNode *	trace;
 };
 
-struct tracker_t
-{
-    size_t	 n_event_bytes;
-    size_t	 n_allocated_bytes;
-    uint8_t	*events;
-};
-
 #define DEFAULT_SIZE	(1024 * 1024 * 4)
 
 static void
@@ -137,6 +139,13 @@ tracker_add_sample  (tracker_t *tracker,
 		     uint64_t  *ips,
 		     int        n_ips)
 {
+    sample_t event;
+
+    event.type = SAMPLE;
+    event.pid = pid;
+    event.trace = stack_stash_add_trace (tracker->stash, ips, n_ips, 1);
+
+    tracker_append (tracker, &event, sizeof (event));
 }
 
 Profile *



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