summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2007-12-04 16:52:52 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2007-12-04 16:52:52 +0000
commitf3ba4a775af355dae3511470ad46e2111418dde8 (patch)
tree3a5b4981d1caec06dc50c8c9c90d6f35e94f4277 /src/app.c
parent87ed08fb805a6af242b5563f1a34f5d93c7ca173 (diff)
Add an initial client summary.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c68
1 files changed, 23 insertions, 45 deletions
diff --git a/src/app.c b/src/app.c
index de426c1..ea3a2f6 100644
--- a/src/app.c
+++ b/src/app.c
@@ -32,6 +32,7 @@
#include <errno.h>
#include "odin.h"
+#include "client.h"
#include "block.h"
#include "callgraph.h"
#include "frames.h"
@@ -39,47 +40,10 @@
#include "lwp-events.h"
-struct _client {
- enum {
- LWP,
- VALGRIND
- } type;
- gboolean active;
-
- gchar *name;
- GPid pid;
- gboolean terminated;
-
- guint last;
-
- Allocator *allocators;
- struct {
- guint size;
- guint nnodes;
- Allocator **nodes;
- } allocator_by_addr;
-
- Block *blocks;
- struct {
- guint size;
- guint nnodes;
- Block **nodes;
- } block_by_addr;
-
- Frames frames;
-
- CallGraphStore *call_graph;
-
- GArray *events;
-
- Chunk *perm_chunks;
- Chunk *block_chunks;
- Block *block_free_list;
-};
-
struct _app {
GdkCursor *busy_cursor;
GtkWidget *window;
+ GtkWidget *summary;
struct {
GtkWidget *allocators;
GtkWidget *block_map;
@@ -667,7 +631,7 @@ _client_update_alloc_fn (Client *client)
}
static void
-app_update_allocators (App *app, guint time)
+app_update_allocators (App *app, Client *client, guint time)
{
_client_update_alloc_fn (&app->client);
@@ -679,9 +643,19 @@ app_update_allocators (App *app, guint time)
timeline_add_datum ((Timeline *) app->timeline, &app->client,
time, app->client.allocators);
+ summary_update ((Summary *) app->summary, client);
+
app->client.last = time;
}
+static void
+app_update_client (App *app, Client *client, guint time)
+{
+ app_update_allocators (app, client, time);
+ app_set_blocks (app, client->blocks);
+}
+
+
static gboolean
vg_read (GIOChannel *io, App *app)
{
@@ -865,9 +839,8 @@ vg_read (GIOChannel *io, App *app)
g_array_append_val (app->client.events, ev);
}
- app_update_allocators (app, time);
- app_set_blocks (app, app->client.blocks = blocks);
-
+ app->client.blocks = blocks;
+ app_update_client (app, &app->client, time);
app_update_status (app);
return TRUE;
@@ -961,6 +934,8 @@ main_window_create (App *app)
app->allocations.tree_map = call_graph_tree_map_new ();
app->allocations.ring = call_graph_ring_new ();
+ app->summary = summary_new ();
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (app->allocations.call_graph));
g_signal_connect (selection, "changed",
G_CALLBACK (call_graph_selection_changed),
@@ -1004,6 +979,11 @@ main_window_create (App *app)
gtk_box_pack_start (GTK_BOX (vbox), app->statusbar, FALSE, FALSE, 2);
gtk_widget_show (app->statusbar);
+ label = gtk_label_new ("Summary");
+ gtk_notebook_append_page (GTK_NOTEBOOK (app->notebook), app->summary, label);
+ gtk_widget_show (label);
+ gtk_widget_show (app->summary);
+
hbox = gtk_hbox_new (FALSE, 2);
label = gtk_label_new ("Allocation Map");
gtk_notebook_append_page (GTK_NOTEBOOK (app->notebook), hbox, label);
@@ -1601,14 +1581,12 @@ lwp_read (GIOChannel *io, App *app)
}
}
- app_update_allocators (app, time);
- app_set_blocks (app, app->client.blocks);
-
if (app->client.pid) {
if (! _get_pid_cmd (app->client.pid, client, G_N_ELEMENTS (client)))
strcpy (client, "«unknown»");
_app_set_client_name (app, client);
}
+ app_update_client (app, &app->client, time);
app_update_status (app);
return TRUE;