aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--kernel-shark.c17
-rw-r--r--kernel-shark.h8
-rw-r--r--trace-graph-main.c4
-rw-r--r--trace-view-main.c4
-rw-r--r--trace-view-store.c10
6 files changed, 33 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 9975f2f..0f65858 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ trace-view-main.o:: $(HEADERS) trace-view-store.h trace-view.h
38trace-filter.o:: $(HEADERS) 38trace-filter.o:: $(HEADERS)
39trace-graph.o:: $(HEADERS) trace-graph.h 39trace-graph.o:: $(HEADERS) trace-graph.h
40trace-graph-main.o:: $(HEADERS) trace-graph.h 40trace-graph-main.o:: $(HEADERS) trace-graph.h
41kernel-shark.o:: $(HEADERS) 41kernel-shark.o:: $(HEADERS) kernel-shark.h
42 42
43TRACE_VIEW_OBJS = trace-view.o trace-view-store.o trace-filter.o 43TRACE_VIEW_OBJS = trace-view.o trace-view-store.o trace-filter.o
44 44
diff --git a/kernel-shark.c b/kernel-shark.c
index e40304a..d1952ba 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -74,9 +74,12 @@ static void ks_graph_select(struct graph_info *ginfo, guint64 cursor)
74 74
75/* Callback for the clicked signal of the Exit button */ 75/* Callback for the clicked signal of the Exit button */
76static void 76static void
77exit_clicked (GtkWidget *widget, gpointer data) 77exit_clicked (gpointer data)
78{ 78{
79 gtk_widget_destroy (GTK_WIDGET (data)); /* the user data points to the main window */ 79 struct shark_info *info = data;
80
81 gtk_widget_destroy (info->window); /* the user data points to the main window */
82 tracecmd_close(info->handle);
80 gtk_main_quit (); 83 gtk_main_quit ();
81} 84}
82 85
@@ -84,7 +87,10 @@ exit_clicked (GtkWidget *widget, gpointer data)
84static gint 87static gint
85delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) 88delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
86{ 89{
90 struct shark_info *info = data;
91
87 gtk_widget_destroy (widget); /* destroy the main window */ 92 gtk_widget_destroy (widget); /* destroy the main window */
93 tracecmd_close(info->handle);
88 gtk_main_quit (); 94 gtk_main_quit ();
89 return TRUE; 95 return TRUE;
90} 96}
@@ -128,9 +134,9 @@ void kernel_shark(int argc, char **argv)
128 die("Unable to allocate info"); 134 die("Unable to allocate info");
129 135
130 handle = tracecmd_open(input_file); 136 handle = tracecmd_open(input_file);
131
132 if (!handle) 137 if (!handle)
133 die("error reading header"); 138 die("error reading header");
139 info->handle = handle;
134 140
135 if (tracecmd_read_headers(handle) < 0) 141 if (tracecmd_read_headers(handle) < 0)
136 return; 142 return;
@@ -143,6 +149,7 @@ void kernel_shark(int argc, char **argv)
143 /* --- Main window --- */ 149 /* --- Main window --- */
144 150
145 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 151 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
152 info->window = window;
146 153
147 /* --- Top Level Vbox --- */ 154 /* --- Top Level Vbox --- */
148 155
@@ -176,7 +183,7 @@ void kernel_shark(int argc, char **argv)
176 /* We can attach the Quit menu item to our exit function */ 183 /* We can attach the Quit menu item to our exit function */
177 g_signal_connect_swapped (G_OBJECT (sub_item), "activate", 184 g_signal_connect_swapped (G_OBJECT (sub_item), "activate",
178 G_CALLBACK (exit_clicked), 185 G_CALLBACK (exit_clicked),
179 (gpointer) window); 186 (gpointer) info);
180 187
181 /* We do need to show menu items */ 188 /* We do need to show menu items */
182 gtk_widget_show(sub_item); 189 gtk_widget_show(sub_item);
@@ -308,7 +315,7 @@ void kernel_shark(int argc, char **argv)
308 315
309 gtk_signal_connect (GTK_OBJECT (window), "delete_event", 316 gtk_signal_connect (GTK_OBJECT (window), "delete_event",
310 (GtkSignalFunc) delete_event, 317 (GtkSignalFunc) delete_event,
311 NULL); 318 (gpointer) info);
312 319
313 gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT); 320 gtk_widget_set_size_request(window, TRACE_WIDTH, TRACE_HEIGHT);
314 321
diff --git a/kernel-shark.h b/kernel-shark.h
index 3433901..bf9e632 100644
--- a/kernel-shark.h
+++ b/kernel-shark.h
@@ -5,9 +5,11 @@
5#include "trace-view.h" 5#include "trace-view.h"
6 6
7struct shark_info { 7struct shark_info {
8 struct graph_info *ginfo; 8 GtkWidget *window;
9 GtkWidget *treeview; 9 struct graph_info *ginfo;
10 struct graph_callbacks graph_cbs; 10 struct tracecmd_input *handle;
11 GtkWidget *treeview;
12 struct graph_callbacks graph_cbs;
11}; 13};
12 14
13#define offset_of(type, field) (long)(&((type *)0)->field) 15#define offset_of(type, field) (long)(&((type *)0)->field)
diff --git a/trace-graph-main.c b/trace-graph-main.c
index d192f63..4eb257f 100644
--- a/trace-graph-main.c
+++ b/trace-graph-main.c
@@ -9,12 +9,14 @@
9#define TRACE_HEIGHT 600 9#define TRACE_HEIGHT 600
10#define input_file "trace.dat" 10#define input_file "trace.dat"
11 11
12static struct graph_info *ginfo;
12 13
13/* Callback for the clicked signal of the Exit button */ 14/* Callback for the clicked signal of the Exit button */
14static void 15static void
15exit_clicked (GtkWidget *widget, gpointer data) 16exit_clicked (GtkWidget *widget, gpointer data)
16{ 17{
17 gtk_widget_destroy (GTK_WIDGET (data)); /* the user data points to the main window */ 18 gtk_widget_destroy (GTK_WIDGET (data)); /* the user data points to the main window */
19 tracecmd_close(ginfo->handle);
18 gtk_main_quit (); 20 gtk_main_quit ();
19} 21}
20 22
@@ -23,6 +25,7 @@ static gint
23delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) 25delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
24{ 26{
25 gtk_widget_destroy (widget); /* destroy the main window */ 27 gtk_widget_destroy (widget); /* destroy the main window */
28 tracecmd_close(ginfo->handle);
26 gtk_main_quit (); 29 gtk_main_quit ();
27 return TRUE; 30 return TRUE;
28} 31}
@@ -30,7 +33,6 @@ delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
30void trace_graph(int argc, char **argv) 33void trace_graph(int argc, char **argv)
31{ 34{
32 struct tracecmd_input *handle; 35 struct tracecmd_input *handle;
33 struct graph_info *ginfo;
34 GtkWidget *window; 36 GtkWidget *window;
35 GtkWidget *vbox; 37 GtkWidget *vbox;
36 GtkWidget *hbox; 38 GtkWidget *hbox;
diff --git a/trace-view-main.c b/trace-view-main.c
index bf01543..c0eb716 100644
--- a/trace-view-main.c
+++ b/trace-view-main.c
@@ -10,12 +10,14 @@
10#define input_file "trace.dat" 10#define input_file "trace.dat"
11 11
12GtkWidget *trace_tree; 12GtkWidget *trace_tree;
13static struct tracecmd_input *handle;
13 14
14/* Callback for the clicked signal of the Exit button */ 15/* Callback for the clicked signal of the Exit button */
15static void 16static void
16exit_clicked (GtkWidget *widget, gpointer data) 17exit_clicked (GtkWidget *widget, gpointer data)
17{ 18{
18 gtk_widget_destroy (GTK_WIDGET (data)); /* the user data points to the main window */ 19 gtk_widget_destroy (GTK_WIDGET (data)); /* the user data points to the main window */
20 tracecmd_close(handle);
19 gtk_main_quit (); 21 gtk_main_quit ();
20} 22}
21 23
@@ -24,6 +26,7 @@ static gint
24delete_event (GtkWidget *widget, GdkEvent *event, gpointer data) 26delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
25{ 27{
26 gtk_widget_destroy (widget); /* destroy the main window */ 28 gtk_widget_destroy (widget); /* destroy the main window */
29 tracecmd_close(handle);
27 gtk_main_quit (); 30 gtk_main_quit ();
28 return TRUE; 31 return TRUE;
29} 32}
@@ -63,7 +66,6 @@ create_combo_box_model(void)
63 66
64void trace_view(int argc, char **argv) 67void trace_view(int argc, char **argv)
65{ 68{
66 struct tracecmd_input *handle;
67 GtkWidget *window; 69 GtkWidget *window;
68 GtkWidget *vbox; 70 GtkWidget *vbox;
69 GtkWidget *hbox; 71 GtkWidget *hbox;
diff --git a/trace-view-store.c b/trace-view-store.c
index 6ee5e46..85c36e0 100644
--- a/trace-view-store.c
+++ b/trace-view-store.c
@@ -206,9 +206,17 @@ static void
206trace_view_store_finalize (GObject *object) 206trace_view_store_finalize (GObject *object)
207{ 207{
208 TraceViewStore *store = TRACE_VIEW_STORE(object); 208 TraceViewStore *store = TRACE_VIEW_STORE(object);
209 gint cpu;
209 210
210 /* free all records and free all memory used by the list */ 211 /* free all records and free all memory used by the list */
211#warning IMPLEMENT 212
213 for (cpu = 0; cpu < store->cpus; cpu++)
214 g_free(store->cpu_list[cpu]);
215
216 g_free(store->cpu_list);
217 g_free(store->cpu_mask);
218 g_free(store->rows);
219 g_free(store->cpu_items);
212 220
213 if (store->spin) { 221 if (store->spin) {
214 gtk_widget_destroy(store->spin); 222 gtk_widget_destroy(store->spin);