[sysprof] Add code to append map and process events
- From: Søren Sandmann Pedersen <ssp src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sysprof] Add code to append map and process events
- Date: Mon, 14 Sep 2009 09:07:26 +0000 (UTC)
commit e1cfbc4c53470d1b423812b2b237bf81d3d4001f
Author: Søren Sandmann Pedersen <ssp redhat com>
Date: Mon Sep 7 10:14:01 2009 -0400
Add code to append map and process events
tracker.c | 39 +++++++++++++++++++++++++++++++++++++--
tracker.h | 13 +++++++++++--
2 files changed, 48 insertions(+), 4 deletions(-)
---
diff --git a/tracker.c b/tracker.c
index fee8d15..b5cbfe0 100644
--- a/tracker.c
+++ b/tracker.c
@@ -86,14 +86,49 @@ tracker_free (tracker_t *tracker)
}
+#define COPY_STRING(dest, src) \
+ do \
+ { \
+ strncpy (dest, src, sizeof (dest) - 1); \
+ dest[sizeof (dest) - 1] = 0; \
+ } \
+ while (0)
+
+
void
-tracker_add_process (tracker_t *tracker)
+tracker_add_process (tracker_t * tracker,
+ pid_t pid,
+ const char *command_line)
{
+ new_process_t event;
+
+ event.type = NEW_PROCESS;
+ event.pid = pid;
+ COPY_STRING (event.command_line, command_line);
+
+ tracker_append (tracker, &event, sizeof (event));
}
void
-tracker_add_map (tracker_t *tracker)
+tracker_add_map (tracker_t * tracker,
+ pid_t pid,
+ uint64_t start,
+ uint64_t end,
+ uint64_t offset,
+ uint64_t inode,
+ const char *filename)
{
+ new_map_t event;
+
+ event.type = NEW_MAP;
+ event.pid = pid;
+ COPY_STRING (event.file_name, filename);
+ event.start = start;
+ event.end = end;
+ event.offset = offset;
+ event.inode = inode;
+
+ tracker_append (tracker, &event, sizeof (event));
}
void
diff --git a/tracker.h b/tracker.h
index 839ccf8..e4caf60 100644
--- a/tracker.h
+++ b/tracker.h
@@ -6,8 +6,17 @@ typedef struct tracker_t tracker_t;
tracker_t *tracker_new (void);
void tracker_free (tracker_t *);
-void tracker_add_process (tracker_t *tracker);
-void tracker_add_map (tracker_t *tracker);
+void tracker_add_process (tracker_t *tracker,
+ pid_t pid,
+ const char *command_line);
+void
+tracker_add_map (tracker_t * tracker,
+ pid_t pid,
+ uint64_t start,
+ uint64_t end,
+ uint64_t offset,
+ uint64_t inode,
+ const char *filename);
void tracker_add_sample (tracker_t *tracker,
pid_t pid,
uint64_t *ips,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]