summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-05-08 10:34:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-05-08 10:34:54 +0100
commit6d366d4c2971d8769ab432d7a7e288368d6a18f2 (patch)
treef1bcdee4b1bd6451cad54fb31a01d2eaccf9b5fd
parent5d6514214e9e51b9ac0a34ebb91692ef35559280 (diff)
Fix misaccumulation in callgraph.
-rw-r--r--src/app.c18
-rw-r--r--src/callgraph-store.c21
2 files changed, 25 insertions, 14 deletions
diff --git a/src/app.c b/src/app.c
index cff3f7e..5e6358d 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1907,17 +1907,14 @@ _update_client (App *app)
_client_update_alloc_fn (&app->client);
_client_update_max_bytes (&app->client);
- app_set_blocks (app, app->client.blocks);
-
- call_graph_store_update (app->client.call_graph,
- app,
- app->client.allocators,
- app->client.last);
+ if (app->client.update) {
+ app_set_blocks (app, app->client.blocks);
- summary_update ((Summary *) app->summary_total, &app->client);
- summary_update ((Summary *) app->summary_current, &app->client);
+ call_graph_store_update (app->client.call_graph,
+ app,
+ app->client.allocators,
+ app->client.last);
- if (app->client.update) {
timeline_add_datum ((Timeline *) app->timeline, &app->client,
app->client.time, app->client.allocators);
@@ -1927,6 +1924,9 @@ _update_client (App *app)
app->client.update = FALSE;
}
+ summary_update ((Summary *) app->summary_total, &app->client);
+ summary_update ((Summary *) app->summary_current, &app->client);
+
if (app->client.pid && ! app->client.terminated) {
GtkTreeModel *model;
char client[1024];
diff --git a/src/callgraph-store.c b/src/callgraph-store.c
index 3a300d5..b8390f9 100644
--- a/src/callgraph-store.c
+++ b/src/callgraph-store.c
@@ -946,6 +946,7 @@ call_graph_store_update (CallGraphStore *store,
_call_graph_frame_accumulate (child, At, Ap);
child->stamp = store->stamp;
+ frame = child;
AA = child->allocator;
if (AA != NULL) {
@@ -963,18 +964,28 @@ call_graph_store_update (CallGraphStore *store,
min_frames = MIN (A->n_frames, AA->n_frames);
while (n < min_frames && A->frames[n] == AA->frames[n]) {
child = _call_graph_frame_new (store, AA, n, child);
- _call_graph_frame_accumulate (child, At, Ap);
+ child->bytes = frame->bytes;
+ child->allocs = frame->allocs;
+ child->frees = frame->frees;
child->allocator = NULL;
n++;
}
- if (n < AA->n_frames)
- _call_graph_frame_new (store, AA, n, child);
if (n < A->n_frames)
_call_graph_frame_new (store, A, n, child);
+ if (n < AA->n_frames) {
+ At = AA->time_tail;
+ Ap = At->prev;
+ while (Ap != NULL && Ap->time > since)
+ Ap = Ap->prev;
+ if (Ap == NULL)
+ Ap = &nil;
+
+ if (At->time <= since || At->n_allocs - Ap->n_allocs == 0)
+ _call_graph_frame_new (store, AA, n, child);
+ }
break;
- } else
- frame = child;
+ }
}
updated++;
}