diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-04-25 17:33:40 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-04-25 17:33:40 +0100 |
commit | 4605365e0f7f2b6ebde4b6517772acc1bf05ad66 (patch) | |
tree | 1a7f2709bcef8dd68373561630c7e313638223cc | |
parent | 89c53508be71de23da5b9ab1c3af19b93346b55b (diff) |
Only update the timeline if the client has performed mallocs/frees etc.
-rw-r--r-- | src/app.c | 28 | ||||
-rw-r--r-- | src/client.h | 1 |
2 files changed, 21 insertions, 8 deletions
@@ -1249,9 +1249,9 @@ _allocator_get_time (Client *client, Allocator *A, guint32 time) static guint log2_ceil (guint n) { - guint i = 0; - while (1U<<i < n) - i++; + guint i = 1; + while (n >>= 1) + i++; return i; } @@ -1373,6 +1373,7 @@ _client_init (Client *client, App *app) { client->active = TRUE; client->name = NULL; + client->update = FALSE; shared_objects_init (&client->objects, client); frames_init (&client->frames, client); @@ -1551,6 +1552,7 @@ lwp_read (gzFile *file, App *app) pid_t pid; guint32 time; gchar client[1024]; + gboolean update; if (! readn (file, client, 4) || strcmp (client, "LWP")) return FALSE; @@ -1658,6 +1660,7 @@ lwp_read (gzFile *file, App *app) if (! readn (file, &count, sizeof (count))) return FALSE; + update = FALSE; while (count--) { LWP_EventRecord ev; char c; @@ -1691,6 +1694,7 @@ lwp_read (gzFile *file, App *app) break; case LWP_MALLOC: + update = TRUE; readn (file, &ev.event.malloc.size, sizeof (ev.event.malloc.size)); readn (file, &ev.event.malloc.addr, sizeof (ev.event.malloc.addr)); _client_new_block (&app->client, @@ -1702,6 +1706,7 @@ lwp_read (gzFile *file, App *app) break; case LWP_MEMALIGN: + update = TRUE; readn (file, &ev.event.memalign.align, sizeof (ev.event.memalign.align)); readn (file, &ev.event.memalign.size, sizeof (ev.event.memalign.size)); readn (file, &ev.event.memalign.addr, sizeof (ev.event.memalign.addr)); @@ -1715,6 +1720,7 @@ lwp_read (gzFile *file, App *app) case LWP_REALLOC: + update = TRUE; readn (file, &ev.event.realloc.size, sizeof (ev.event.realloc.size)); readn (file, &ev.event.realloc.old_addr, sizeof (ev.event.realloc.old_addr)); readn (file, &ev.event.realloc.new_addr, sizeof (ev.event.realloc.new_addr)); @@ -1728,6 +1734,7 @@ lwp_read (gzFile *file, App *app) break; case LWP_FREE: + update = TRUE; readn (file, &ev.event.free.addr, sizeof (ev.event.free.addr)); if (ev.event.free.addr != NULL) _client_delete_block (&app->client, @@ -1739,6 +1746,8 @@ lwp_read (gzFile *file, App *app) } } + app->client.update |= update; + return TRUE; } @@ -1908,12 +1917,15 @@ _update_client (App *app) summary_update ((Summary *) app->summary_total, &app->client); summary_update ((Summary *) app->summary_current, &app->client); - timeline_add_datum ((Timeline *) app->timeline, &app->client, - app->client.time, app->client.allocators); + if (app->client.update) { + timeline_add_datum ((Timeline *) app->timeline, &app->client, + app->client.time, app->client.allocators); - spacetime_add_datum ((Spacetime *) app->spacetime, &app->client, - app->client.time, app->client.allocators); - app->client.last = app->client.time; + spacetime_add_datum ((Spacetime *) app->spacetime, &app->client, + app->client.time, app->client.allocators); + app->client.last = app->client.time; + app->client.update = FALSE; + } if (app->client.pid && ! app->client.terminated) { GtkTreeModel *model; diff --git a/src/client.h b/src/client.h index f603d9f..5a17840 100644 --- a/src/client.h +++ b/src/client.h @@ -49,6 +49,7 @@ struct _client { guint time; guint last; + gboolean update; Allocator *allocators; struct { |