summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-12-25 12:34:43 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2007-12-25 12:34:43 +0000
commit91943cc97d205f69c315d9b4e91e925218da7607 (patch)
treeaccacddb6ed9cc701e3e423dcb6e9565b5692bfc
parent3b557d37600e63ab7f0ee2f6e086c761670b7ab4 (diff)
Accumulate active bytes.
-rw-r--r--src/spacetime.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/spacetime.c b/src/spacetime.c
index 1a1e2da..94a9d0e 100644
--- a/src/spacetime.c
+++ b/src/spacetime.c
@@ -141,7 +141,7 @@ allocator_path (Spacetime *self,
guint64 bytes;
SpacetimeData *data, *start, *last;
guint n, n_allocators;
- guint min_time, last_time;
+ guint min_time;
data = *_data;
if (data == NULL)
@@ -154,9 +154,12 @@ allocator_path (Spacetime *self,
for (l = sA->allocators; l != NULL; l = g_slist_next (l)) {
A = l->data;
At[n] = A->time;
- while (At[n] != NULL && At[n]->time < data->time) {
+ while (At[n] != NULL && At[n]->time <= data->time) {
At[n] = At[n]->next;
}
+ if (At[n] != NULL && At[n]->prev != NULL)
+ At[n] = At[n]->prev;
+
while (At[n] != NULL) {
if (At[n]->bytes != At[n]->freed)
break;
@@ -179,10 +182,8 @@ allocator_path (Spacetime *self,
data = data->next;
if (data->prev == NULL) {
cairo_move_to (cr, 0, 0);
- last_time = 0;
} else {
cairo_move_to (cr, data->prev->time, data->prev->sum_bytes);
- last_time = data->prev->time;
}
start = data->prev;
last = data;
@@ -190,13 +191,12 @@ allocator_path (Spacetime *self,
bytes = 0;
min_time = (guint) -1;
for (n = 0; n < n_allocators; n++) {
- while (At[n] != NULL &&
- At[n]->time > last_time &&
- At[n]->time <= data->time)
- {
- bytes += At[n]->bytes;
+ gsize last_bytes = 0;
+ while (At[n] != NULL && At[n]->time <= data->time) {
+ last_bytes = At[n]->bytes - At[n]->freed;
At[n] = At[n]->next;
}
+ bytes += last_bytes;
if (At[n] != NULL && At[n]->time < min_time)
min_time = At[n]->time;
}
@@ -219,15 +219,13 @@ allocator_path (Spacetime *self,
bytes = 0;
min_time = (guint) -1;
- last_time = data->prev->time;
for (n = 0; n < n_allocators; n++) {
- while (At[n] != NULL &&
- At[n]->time > last_time &&
- At[n]->time <= data->time)
- {
- bytes += At[n]->bytes;
+ gsize last_bytes = 0;
+ while (At[n] != NULL && At[n]->time <= data->time) {
+ last_bytes = At[n]->bytes - At[n]->freed;
At[n] = At[n]->next;
}
+ bytes += last_bytes;
if (At[n] != NULL && At[n]->time < min_time)
min_time = At[n]->time;
}