diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-03 12:32:48 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-03 12:32:48 -0500 |
commit | 4899bdc41c78242f0b745783b34837a20345b092 (patch) | |
tree | 7c3078bd3b34cb09ea54594634c64b57a51fa88e | |
parent | 5a19a97b04e3909384aee2ad984ec28c83383c3b (diff) |
support system events
-rw-r--r-- | include/load.h | 1 | ||||
-rw-r--r-- | src/load.c | 19 |
2 files changed, 15 insertions, 5 deletions
diff --git a/include/load.h b/include/load.h index cf2c6c3..e460e7a 100644 --- a/include/load.h +++ b/include/load.h | |||
@@ -23,6 +23,7 @@ struct task { | |||
23 | #define MAX_TASKS 100 | 23 | #define MAX_TASKS 100 |
24 | 24 | ||
25 | extern struct task tasks[MAX_TASKS]; | 25 | extern struct task tasks[MAX_TASKS]; |
26 | extern struct evlink* sys_events; | ||
26 | extern u64 time0; | 27 | extern u64 time0; |
27 | extern u32 g_min_task; | 28 | extern u32 g_min_task; |
28 | extern u32 g_max_task; | 29 | extern u32 g_max_task; |
@@ -84,6 +84,8 @@ struct heap* load(char **files, int no_files, unsigned int *count) | |||
84 | 84 | ||
85 | 85 | ||
86 | struct task tasks[MAX_TASKS]; | 86 | struct task tasks[MAX_TASKS]; |
87 | struct evlink *sys_events = NULL; | ||
88 | struct evlink **sys_next = &sys_events; | ||
87 | u64 time0 = 0; | 89 | u64 time0 = 0; |
88 | u32 g_max_task = MAX_TASKS; | 90 | u32 g_max_task = MAX_TASKS; |
89 | u32 g_min_task = 0; | 91 | u32 g_min_task = 0; |
@@ -112,6 +114,8 @@ void crop_events_all(double min, double max) | |||
112 | struct task* by_pid(int pid) | 114 | struct task* by_pid(int pid) |
113 | { | 115 | { |
114 | struct task* t; | 116 | struct task* t; |
117 | if (!pid) | ||
118 | return NULL; | ||
115 | /* slow, don't care for now */ | 119 | /* slow, don't care for now */ |
116 | for (t = tasks; t < tasks + MAX_TASKS; t++) { | 120 | for (t = tasks; t < tasks + MAX_TASKS; t++) { |
117 | if (!t->pid) /* end, allocate */ | 121 | if (!t->pid) /* end, allocate */ |
@@ -152,8 +156,8 @@ void split(struct heap* h, unsigned int count) | |||
152 | if (!time0 && time) | 156 | if (!time0 && time) |
153 | time0 = time; | 157 | time0 = time; |
154 | t = by_pid(rec->hdr.pid); | 158 | t = by_pid(rec->hdr.pid); |
155 | if (!t) { | 159 | if (!t && rec->hdr.pid) { |
156 | printf("dropped %d\n", rec->hdr.pid); | 160 | fprintf(stderr, "dropped %d\n", rec->hdr.pid); |
157 | continue; | 161 | continue; |
158 | } | 162 | } |
159 | switch (rec->hdr.type) { | 163 | switch (rec->hdr.type) { |
@@ -166,10 +170,15 @@ void split(struct heap* h, unsigned int count) | |||
166 | default: | 170 | default: |
167 | lnk->rec = rec; | 171 | lnk->rec = rec; |
168 | lnk->next = NULL; | 172 | lnk->next = NULL; |
169 | *(t->next) = lnk; | 173 | if (t) { |
170 | t->next = &lnk->next; | 174 | *(t->next) = lnk; |
175 | t->next = &lnk->next; | ||
176 | t->no_events++; | ||
177 | } else { | ||
178 | *(sys_next) = lnk; | ||
179 | sys_next = &lnk->next; | ||
180 | } | ||
171 | lnk++; | 181 | lnk++; |
172 | t->no_events++; | ||
173 | break; | 182 | break; |
174 | } | 183 | } |
175 | } | 184 | } |