diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-11 15:05:58 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-12-11 15:05:58 +0000 |
commit | 4065e4bc42276c02cfad77c52510a1313caf3ee3 (patch) | |
tree | 3e9513da75192854b3b5754a202e8a0d52898346 | |
parent | 10276b0772e3a5ce8218d01035249a3db63b714d (diff) |
Match the env var with a strcmp rather than a potential partial match.
-rw-r--r-- | src/app.c | 45 |
1 files changed, 38 insertions, 7 deletions
@@ -48,6 +48,7 @@ struct _app { guint busy_count; GtkWidget *window; + GtkWidget *notebook; GtkWidget *summary; struct { GtkWidget *allocators; @@ -58,8 +59,8 @@ struct _app { GtkWidget *tree_map; GtkWidget *ring; } allocations; + GtkWidget *spacetime; GtkWidget *procmap; - GtkWidget *notebook; GtkWidget *timeline; GtkWidget *statusbar; @@ -305,6 +306,7 @@ read_allocator (App *app, int fd, guint time) if (A == NULL) { A = client_perm_alloc (&app->client, sizeof (Allocator)); A->key = key; + A->max_bytes = 0; At = &A->time[0]; A->time_tail = NULL; @@ -634,9 +636,24 @@ _client_update_alloc_fn (Client *client) } static void +_client_update_max_bytes (Client *client, guint time) +{ + Allocator *A; + + for (A = client->allocators; A != NULL; A = A->next) { + AllocatorTime *At = A->time_tail; + guint64 bytes = At->bytes - At->freed; + if (bytes > A->max_bytes) + A->max_bytes = bytes; + } +} + +static void app_update_allocators (App *app, Client *client, guint time) { _client_update_alloc_fn (&app->client); + _client_update_max_bytes (&app->client, time); + call_graph_store_update (app->client.call_graph, app, @@ -646,6 +663,9 @@ app_update_allocators (App *app, Client *client, guint time) timeline_add_datum ((Timeline *) app->timeline, &app->client, time, app->client.allocators); + spacetime_add_datum ((Spacetime *) app->spacetime, &app->client, + time, app->client.allocators); + summary_update ((Summary *) app->summary, client); app->client.last = time; @@ -950,6 +970,8 @@ main_window_create (App *app) app->allocations.tree_map = call_graph_tree_map_new (); app->allocations.ring = call_graph_ring_new (); + app->spacetime = spacetime_new (); + app->summary = summary_new (); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->allocations.call_graph)); @@ -1053,6 +1075,12 @@ main_window_create (App *app) gtk_widget_show (hbox); gtk_widget_show (label); + label = gtk_label_new ("Spacetime"); + gtk_notebook_append_page (GTK_NOTEBOOK (app->notebook), + app->spacetime, label); + gtk_widget_show (app->spacetime); + gtk_widget_show (label); + return app->window; } @@ -1599,6 +1627,7 @@ lwp_read (GIOChannel *io, App *app) /* construct bare allocator... */ A = client_perm_alloc (&app->client, sizeof (Allocator)); A->key = key; + A->max_bytes = 0; A->time[0].prev = NULL; A->time[0].next = NULL; A->time_tail = &A->time[0]; @@ -2066,13 +2095,15 @@ execute_cmdline_lwp (App *app, char **argv, GError **error) envp = g_new (gchar *, g_strv_length (env) + n_client_env + 3); have_preload = have_socket = FALSE; for (i = n = 0; env[n] != NULL; n++) { - for (m = 0; m < n_client_env; m++) { - const char *equals = strchr (argv[m], '='); - if (strncmp (env[n], argv[m], equals - argv[m]) == 0) { - break; - } + gboolean found = FALSE; + for (m = 0; ! found && m < n_client_env; m++) { + char *equals = strchr (argv[m], '='); + g_assert (equals != NULL); + *equals = '\0'; + found = strcmp (env[n], argv[m]) == 0; + *equals = '='; } - if (m < n_client_env) { + if (found) { /* override with the user's cmdline var */ continue; } |