summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2008-11-03 12:32:48 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2008-11-03 12:32:48 -0500
commit4899bdc41c78242f0b745783b34837a20345b092 (patch)
tree7c3078bd3b34cb09ea54594634c64b57a51fa88e
parent5a19a97b04e3909384aee2ad984ec28c83383c3b (diff)
support system events
-rw-r--r--include/load.h1
-rw-r--r--src/load.c19
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
25extern struct task tasks[MAX_TASKS]; 25extern struct task tasks[MAX_TASKS];
26extern struct evlink* sys_events;
26extern u64 time0; 27extern u64 time0;
27extern u32 g_min_task; 28extern u32 g_min_task;
28extern u32 g_max_task; 29extern u32 g_max_task;
diff --git a/src/load.c b/src/load.c
index 2796222..e97bdc4 100644
--- a/src/load.c
+++ b/src/load.c
@@ -84,6 +84,8 @@ struct heap* load(char **files, int no_files, unsigned int *count)
84 84
85 85
86struct task tasks[MAX_TASKS]; 86struct task tasks[MAX_TASKS];
87struct evlink *sys_events = NULL;
88struct evlink **sys_next = &sys_events;
87u64 time0 = 0; 89u64 time0 = 0;
88u32 g_max_task = MAX_TASKS; 90u32 g_max_task = MAX_TASKS;
89u32 g_min_task = 0; 91u32 g_min_task = 0;
@@ -112,6 +114,8 @@ void crop_events_all(double min, double max)
112struct task* by_pid(int pid) 114struct 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 }