aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2012-03-29 16:23:26 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2012-03-29 16:23:26 -0400
commitf340ebe290d85f6aae234b44ca43aecb106c1e75 (patch)
tree4d0ca8c1fa82ca3aafa8463806e0995844d87fea
parent6c6d6b6ff8ad6cb08d57232ca8ae0ba0261ac823 (diff)
rt-graph: cleanup of interface
-rw-r--r--kernel-shark.c102
-rw-r--r--rt-graph.c2
-rw-r--r--rt-plot-task.c4
-rw-r--r--rt-plot.c27
4 files changed, 74 insertions, 61 deletions
diff --git a/kernel-shark.c b/kernel-shark.c
index 6b6cdd4..924bcc8 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -2401,80 +2401,80 @@ void kernel_shark(int argc, char **argv)
2401 gtk_widget_show(widget); 2401 gtk_widget_show(widget);
2402 2402
2403 2403
2404 /* --- Tree View Vbox --- */ 2404 /* /\* --- Tree View Vbox --- *\/ */
2405 2405
2406 vbox2 = gtk_vbox_new(FALSE, 0); 2406 /* vbox2 = gtk_vbox_new(FALSE, 0); */
2407 gtk_paned_add2(GTK_PANED(vpaned), vbox2); 2407 /* gtk_paned_add2(GTK_PANED(vpaned), vbox2); */
2408 gtk_widget_show(vbox2); 2408 /* gtk_widget_show(vbox2); */
2409 2409
2410 /* --- Paging Hbox --- */ 2410 /* /\* --- Paging Hbox --- *\/ */
2411 2411
2412 hbox = gtk_hbox_new(FALSE, 0); 2412 /* hbox = gtk_hbox_new(FALSE, 0); */
2413 gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); 2413 /* gtk_box_pack_start(GTK_BOX(vbox2), hbox, FALSE, FALSE, 0); */
2414 gtk_widget_show(hbox); 2414 /* gtk_widget_show(hbox); */
2415 2415
2416 /* --- Page Spin Button --- */ 2416 /* /\* --- Page Spin Button --- *\/ */
2417 2417
2418 label = gtk_label_new("Page"); 2418 /* label = gtk_label_new("Page"); */
2419 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 2419 /* gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); */
2420 gtk_widget_show(label); 2420 /* gtk_widget_show(label); */
2421 2421
2422 spin = gtk_spin_button_new(NULL, 1.0, 0); 2422 /* spin = gtk_spin_button_new(NULL, 1.0, 0); */
2423 gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin), 1, 1); 2423 /* gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin), 1, 1); */
2424 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); 2424 /* gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); */
2425 gtk_widget_show(spin); 2425 /* gtk_widget_show(spin); */
2426 2426
2427 info->spin = spin; 2427 /* info->spin = spin; */
2428 2428
2429 /* --- Search --- */ 2429 /* /\* --- Search --- *\/ */
2430 2430
2431 /* The tree needs its columns loaded now */ 2431 /* /\* The tree needs its columns loaded now *\/ */
2432 info->treeview = gtk_tree_view_new(); 2432 /* info->treeview = gtk_tree_view_new(); */
2433 trace_view_load(info->treeview, handle, spin); 2433 /* trace_view_load(info->treeview, handle, spin); */
2434 2434
2435 label = gtk_label_new(" Search: "); 2435 /* label = gtk_label_new(" Search: "); */
2436 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); 2436 /* gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); */
2437 gtk_widget_show(label); 2437 /* gtk_widget_show(label); */
2438 2438
2439 trace_view_search_setup(GTK_BOX(hbox), GTK_TREE_VIEW(info->treeview)); 2439 /* trace_view_search_setup(GTK_BOX(hbox), GTK_TREE_VIEW(info->treeview)); */
2440 2440
2441 check = gtk_check_button_new_with_label("graph follows"); 2441 /* check = gtk_check_button_new_with_label("graph follows"); */
2442 gtk_box_pack_start(GTK_BOX(hbox), check, TRUE, TRUE, 0); 2442 /* gtk_box_pack_start(GTK_BOX(hbox), check, TRUE, TRUE, 0); */
2443 gtk_widget_show(check); 2443 /* gtk_widget_show(check); */
2444 2444
2445 g_signal_connect_swapped (check, "toggled", 2445 /* g_signal_connect_swapped (check, "toggled", */
2446 G_CALLBACK (graph_check_toggle), 2446 /* G_CALLBACK (graph_check_toggle), */
2447 (gpointer) info); 2447 /* (gpointer) info); */
2448 2448
2449 2449
2450 /* --- Top Level Trace View Paging Hbox --- */ 2450 /* /\* --- Top Level Trace View Paging Hbox --- *\/ */
2451 2451
2452 hbox = gtk_hbox_new(FALSE, 0); 2452 /* hbox = gtk_hbox_new(FALSE, 0); */
2453 gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0); 2453 /* gtk_box_pack_start(GTK_BOX(vbox2), hbox, TRUE, TRUE, 0); */
2454 gtk_widget_show(hbox); 2454 /* gtk_widget_show(hbox); */
2455 2455
2456 /* --- Scroll Window --- */ 2456 /* /\* --- Scroll Window --- *\/ */
2457 scrollwin = gtk_scrolled_window_new(NULL, NULL); 2457 /* scrollwin = gtk_scrolled_window_new(NULL, NULL); */
2458 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), 2458 /* gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), */
2459 GTK_POLICY_AUTOMATIC, 2459 /* GTK_POLICY_AUTOMATIC, */
2460 GTK_POLICY_AUTOMATIC); 2460 /* GTK_POLICY_AUTOMATIC); */
2461 gtk_box_pack_start(GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0); 2461 /* gtk_box_pack_start(GTK_BOX (hbox), scrollwin, TRUE, TRUE, 0); */
2462 gtk_widget_show(scrollwin); 2462 /* gtk_widget_show(scrollwin); */
2463 2463
2464 /* --- Set up Trace Tree --- */ 2464 /* /\* --- Set up Trace Tree --- *\/ */
2465 2465
2466 g_signal_connect(info->treeview, "row-activated", 2466 /* g_signal_connect(info->treeview, "row-activated", */
2467 (GCallback)row_double_clicked, info); 2467 /* (GCallback)row_double_clicked, info); */
2468 2468
2469 g_signal_connect(info->treeview, "cursor-changed", 2469 /* g_signal_connect(info->treeview, "cursor-changed", */
2470 (GCallback)cursor_changed, info); 2470 /* (GCallback)cursor_changed, info); */
2471 2471
2472 gtk_container_add(GTK_CONTAINER(scrollwin), info->treeview); 2472 /* gtk_container_add(GTK_CONTAINER(scrollwin), info->treeview); */
2473 2473
2474 gtk_signal_connect(GTK_OBJECT(info->treeview), "button_press_event", 2474 /* gtk_signal_connect(GTK_OBJECT(info->treeview), "button_press_event", */
2475 (GtkSignalFunc) button_press_event, info); 2475 /* (GtkSignalFunc) button_press_event, info); */
2476 2476
2477 gtk_widget_show(info->treeview); 2477 /* gtk_widget_show(info->treeview); */
2478 2478
2479 /* --- Set up Status Bar --- */ 2479 /* --- Set up Status Bar --- */
2480 2480
diff --git a/rt-graph.c b/rt-graph.c
index fbf61bd..e291245 100644
--- a/rt-graph.c
+++ b/rt-graph.c
@@ -462,6 +462,7 @@ int rt_graph_check_task_block(struct graph_info *ginfo,
462 if (!event) 462 if (!event)
463 goto out; 463 goto out;
464 dprintf(2, "Found task_block id %d\n", event->id); 464 dprintf(2, "Found task_block id %d\n", event->id);
465 rtg_info->task_block_id = event->id;
465 STORE_FIELD(rtg_info, event, block, pid); 466 STORE_FIELD(rtg_info, event, block, pid);
466 } 467 }
467 468
@@ -498,6 +499,7 @@ int rt_graph_check_task_resume(struct graph_info *ginfo,
498 if (!event) 499 if (!event)
499 goto out; 500 goto out;
500 dprintf(2, "Found task_resume id %d\n", event->id); 501 dprintf(2, "Found task_resume id %d\n", event->id);
502 rtg_info->task_resume_id = event->id;
501 STORE_FIELD(rtg_info, event, resume, pid); 503 STORE_FIELD(rtg_info, event, resume, pid);
502 } 504 }
503 505
diff --git a/rt-plot-task.c b/rt-plot-task.c
index 56c3c28..de5d2a7 100644
--- a/rt-plot-task.c
+++ b/rt-plot-task.c
@@ -3,7 +3,7 @@
3#include "trace-graph.h" 3#include "trace-graph.h"
4#include "trace-filter.h" 4#include "trace-filter.h"
5 5
6#define DEBUG_LEVEL 1 6#define DEBUG_LEVEL 5
7#if DEBUG_LEVEL > 0 7#if DEBUG_LEVEL > 0
8#define dprintf(l, x...) \ 8#define dprintf(l, x...) \
9 do { \ 9 do { \
@@ -219,6 +219,8 @@ static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info,
219 dprintf(3, "Block for %d on %d at %llu\n", 219 dprintf(3, "Block for %d on %d at %llu\n",
220 pid, record->cpu, ts); 220 pid, record->cpu, ts);
221 ret = 1; 221 ret = 1;
222 } else {
223 dprintf(3, "%d does not match my pid %d\n", pid, rtt_info->pid);
222 } 224 }
223 return ret; 225 return ret;
224} 226}
diff --git a/rt-plot.c b/rt-plot.c
index 10f8b2d..36682a4 100644
--- a/rt-plot.c
+++ b/rt-plot.c
@@ -71,6 +71,9 @@ rt_plot_display_last_event(struct graph_info *ginfo, struct graph_plot *plot,
71 return 1; 71 return 1;
72} 72}
73 73
74/*
75 * Return first displayed record before @time, abandoning search after @range.
76 */
74static struct record* 77static struct record*
75find_prev_display_record(struct graph_info *ginfo, struct rt_plot_common *rt_info, 78find_prev_display_record(struct graph_info *ginfo, struct rt_plot_common *rt_info,
76 unsigned long long time, unsigned long long range) 79 unsigned long long time, unsigned long long range)
@@ -120,15 +123,17 @@ rt_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
120{ 123{
121 struct rt_plot_common *rt_info = plot->private; 124 struct rt_plot_common *rt_info = plot->private;
122 struct event_format *event; 125 struct event_format *event;
123 struct record *record, *prev_record; 126 struct record *record, *prev_record, *data_record;
124 unsigned long long msec, nsec, rts, ptime, rtime, range; 127 unsigned long long msec, nsec, rts, ptime, rtime, range;
125 long long pdiff, rdiff; 128 long long pdiff, rdiff;
126 int eid; 129 int eid;
127 130
128 rt_info->write_header(rt_info, ginfo, s, time); 131 /* Write plot-specific data */
132 data_record = rt_info->write_header(rt_info, ginfo, s, time);
129 133
130 /* Stupid, fix to use resolution */ 134 /* Select closest relevant record */
131 range = 2 / ginfo->resolution; 135 range = 2 / ginfo->resolution;
136
132 record = __find_rt_record(ginfo, rt_info, time, 1, range); 137 record = __find_rt_record(ginfo, rt_info, time, 1, range);
133 prev_record = find_prev_display_record(ginfo, rt_info, time, range); 138 prev_record = find_prev_display_record(ginfo, rt_info, time, range);
134 139
@@ -142,6 +147,7 @@ rt_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
142 record = (pdiff < rdiff) ? prev_record : record; 147 record = (pdiff < rdiff) ? prev_record : record;
143 } 148 }
144 149
150 /* Write event info */
145 if (record) { 151 if (record) {
146 rts = get_rts(ginfo, record); 152 rts = get_rts(ginfo, record);
147 eid = pevent_data_type(ginfo->pevent, record); 153 eid = pevent_data_type(ginfo->pevent, record);
@@ -155,16 +161,19 @@ rt_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
155 pevent_event_info(s, event, record); 161 pevent_event_info(s, event, record);
156 } else 162 } else
157 trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid); 163 trace_seq_printf(s, "\nUNKNOWN EVENT %d\n", eid);
158 } else {
159 trace_seq_printf(s, "Failsauce\n");
160 } 164 }
161 trace_seq_putc(s, '\n');
162 nano_to_milli(time, &msec, &nsec);
163 trace_seq_printf(s, "%llu.%06llu ms CPU: %03d",
164 msec, nsec, record->cpu);
165 free_record(record); 165 free_record(record);
166 } 166 }
167 167
168 /* Metadata */
169 trace_seq_putc(s, '\n');
170 nano_to_milli(time, &msec, &nsec);
171 trace_seq_printf(s, "%llu.%06llu ms", msec, nsec);
172 if (data_record) {
173 trace_seq_printf(s, " CPU: %03d", data_record->cpu);
174 free_record(data_record);
175 }
176
168 return 1; 177 return 1;
169} 178}
170 179