aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-09 01:00:31 -0500
committerJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-09 01:00:31 -0500
commit9b577cded73e720976a004a4f95c68b208296bf0 (patch)
treedf0e42405b78e4884b7d523d366fa14e830d86cd
parent04b0f7d1402124aa7676d0358900af4ea1c04901 (diff)
rt-graph: usability improvements
1. Real-time CPUs are loaded at startup 2. A menu item for loading all real-time tasks is added 3. Black boxes appear around run times when zoomed in
-rw-r--r--kernel-shark.c26
-rw-r--r--rt-graph.c26
-rw-r--r--rt-plot-cpu.c25
-rw-r--r--rt-plot-cpu.h1
-rw-r--r--rt-plot-task.c9
-rw-r--r--rt-plot-task.h2
-rw-r--r--trace-graph.c50
7 files changed, 100 insertions, 39 deletions
diff --git a/kernel-shark.c b/kernel-shark.c
index dc5201c..6e41406 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -1308,6 +1308,15 @@ plot_rt_tasks_clicked (gpointer data)
1308 free(selected); 1308 free(selected);
1309} 1309}
1310 1310
1311static void
1312show_all_rt_clicked (gpointer data)
1313{
1314 struct shark_info *info = data;
1315 struct graph_info *ginfo = info->ginfo;
1316 rt_plot_add_all_tasks(ginfo);
1317 trace_graph_refresh(ginfo);
1318}
1319
1311 1320
1312/* Callback for the clicked signal of the help contents button */ 1321/* Callback for the clicked signal of the help contents button */
1313static void 1322static void
@@ -2015,6 +2024,8 @@ void kernel_shark(int argc, char **argv)
2015 gtk_widget_show(sub_item); 2024 gtk_widget_show(sub_item);
2016 2025
2017 2026
2027
2028
2018 /* --- Filter - Graph Tasks Option --- */ 2029 /* --- Filter - Graph Tasks Option --- */
2019 2030
2020 sub_item = gtk_menu_item_new_with_label("tasks"); 2031 sub_item = gtk_menu_item_new_with_label("tasks");
@@ -2231,6 +2242,21 @@ void kernel_shark(int argc, char **argv)
2231 /* We do need to show menu items */ 2242 /* We do need to show menu items */
2232 gtk_widget_show(sub_item); 2243 gtk_widget_show(sub_item);
2233 2244
2245 /* --- Plot - All RT Tasks Option --- */
2246
2247 sub_item = gtk_menu_item_new_with_label("Show All Real-Time Tasks");
2248
2249 /* Add them to the menu */
2250 gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item);
2251
2252 /* We can attach the Quit menu item to our exit function */
2253 g_signal_connect_swapped (G_OBJECT (sub_item), "activate",
2254 G_CALLBACK (show_all_rt_clicked),
2255 (gpointer) info);
2256
2257 /* We do need to show menu items */
2258 gtk_widget_show(sub_item);
2259
2234 /* --- Plot - RT CPUs Option --- */ 2260 /* --- Plot - RT CPUs Option --- */
2235 2261
2236 sub_item = gtk_menu_item_new_with_label("Real-Time CPUs"); 2262 sub_item = gtk_menu_item_new_with_label("Real-Time CPUs");
diff --git a/rt-graph.c b/rt-graph.c
index 0a72134..4aa06ac 100644
--- a/rt-graph.c
+++ b/rt-graph.c
@@ -1,7 +1,7 @@
1#include "trace-graph.h" 1#include "trace-graph.h"
2#include "trace-hash.h" 2#include "trace-hash.h"
3 3
4#define DEBUG_LEVEL 0 4#define DEBUG_LEVEL 3
5#if DEBUG_LEVEL > 0 5#if DEBUG_LEVEL > 0
6#define dprintf(l, x...) \ 6#define dprintf(l, x...) \
7 do { \ 7 do { \
@@ -86,17 +86,17 @@ int rt_graph_check_any(struct rt_graph_info *rtg_info,
86 86
87/** 87/**
88 * rt_graph_check_task_param - check for litmus_task_param record 88 * rt_graph_check_task_param - check for litmus_task_param record
89 * Return 1 and @pid, @wcet, and @period if the record matches 89 * Return 1 and @pid, @out_wcet, and @out_period if the record matches
90 */ 90 */
91int rt_graph_check_task_param(struct rt_graph_info *rtg_info, 91int rt_graph_check_task_param(struct rt_graph_info *rtg_info,
92 struct pevent *pevent, struct record *record, 92 struct pevent *pevent, struct record *record,
93 gint *pid, unsigned long long *wcet, 93 gint *pid, unsigned long long *out_wcet,
94 unsigned long long *period) 94 unsigned long long *out_period)
95{ 95{
96 struct event_format *event; 96 struct event_format *event;
97 struct rt_task_params *params; 97 struct rt_task_params *params;
98 struct task_list *list; 98 struct task_list *list;
99 unsigned long long val; 99 unsigned long long val, wcet, period;
100 gint id; 100 gint id;
101 int ret = 0; 101 int ret = 0;
102 102
@@ -122,12 +122,12 @@ int rt_graph_check_task_param(struct rt_graph_info *rtg_info,
122 record->data, &val); 122 record->data, &val);
123 *pid = val; 123 *pid = val;
124 pevent_read_number_field(rtg_info->param_wcet_field, 124 pevent_read_number_field(rtg_info->param_wcet_field,
125 record->data, wcet); 125 record->data, &wcet);
126 pevent_read_number_field(rtg_info->param_period_field, 126 pevent_read_number_field(rtg_info->param_period_field,
127 record->data, period); 127 record->data, &period);
128 ret = 1; 128 ret = 1;
129 dprintf(3, "Read task_param (%d) record for task %d " 129 dprintf(3, "Read task_param (%d) record for task %d "
130 "(%llu, %llu)\n", id, *pid, *wcet, *period); 130 "(%llu, %llu)\n", id, *pid, wcet, period);
131 131
132 list = add_task_hash(rtg_info->tasks, *pid); 132 list = add_task_hash(rtg_info->tasks, *pid);
133 if (!list->data) { 133 if (!list->data) {
@@ -138,13 +138,15 @@ int rt_graph_check_task_param(struct rt_graph_info *rtg_info,
138 * Store them with the task to avoid this issue. 138 * Store them with the task to avoid this issue.
139 */ 139 */
140 params = malloc_or_die(sizeof(*params)); 140 params = malloc_or_die(sizeof(*params));
141 params->wcet = *wcet; 141 params->wcet = wcet;
142 params->period = *period; 142 params->period = period;
143 list->data = params; 143 list->data = params;
144 } 144 }
145 145
146 if (*period > rtg_info->max_period) 146 if (period > rtg_info->max_period)
147 rtg_info->max_period = *period; 147 rtg_info->max_period = period;
148 *out_wcet = wcet;
149 *out_period = period;
148 } 150 }
149 out: 151 out:
150 return ret; 152 return ret;
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c
index 7b201dc..25c4ec9 100644
--- a/rt-plot-cpu.c
+++ b/rt-plot-cpu.c
@@ -74,10 +74,16 @@ __find_record(struct graph_info *ginfo, int cpu, unsigned long long time,
74 74
75 while ((record = tracecmd_read_data(ginfo->handle, cpu))) { 75 while ((record = tracecmd_read_data(ginfo->handle, cpu))) {
76 ignored = 0; 76 ignored = 0;
77 if (display) { 77 eid = pevent_data_type(ginfo->pevent, record);
78 eid = pevent_data_type(ginfo->pevent, record); 78
79 if (display)
79 ignored = !is_displayed(ginfo, eid); 80 ignored = !is_displayed(ginfo, eid);
80 } 81 else
82 /* Without this ignore, the info popup is going
83 * to be sched_switchs almost always.
84 */
85 ignored = (eid == ginfo->event_sched_switch_id);
86
81 if (get_rts(ginfo, record) >= time && !ignored) 87 if (get_rts(ginfo, record) >= time && !ignored)
82 break; 88 break;
83 free_record(record); 89 free_record(record);
@@ -342,11 +348,13 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
342 * is_displayed will not work here or in any other methods. 348 * is_displayed will not work here or in any other methods.
343 */ 349 */
344#define ARG rtg_info, ginfo->pevent, record, &pid 350#define ARG rtg_info, ginfo->pevent, record, &pid
351 rt_graph_check_task_param(ARG, &dull, &dull);
345 rt_graph_check_task_release(ARG, &dint, &dull, &dull); 352 rt_graph_check_task_release(ARG, &dint, &dull, &dull);
346 rt_graph_check_task_block(ARG, &dull); 353 rt_graph_check_task_block(ARG, &dull);
347 rt_graph_check_task_resume(ARG, &dull); 354 rt_graph_check_task_resume(ARG, &dull);
348 rt_graph_check_any(ARG, &eid, &ts); 355 rt_graph_check_any(ARG, &eid, &ts);
349#undef ARG 356#undef ARG
357
350 if (is_displayed(ginfo, eid)) { 358 if (is_displayed(ginfo, eid)) {
351 info->line = TRUE; 359 info->line = TRUE;
352 info->lcolor = hash_pid(pid); 360 info->lcolor = hash_pid(pid);
@@ -427,6 +435,8 @@ rt_cpu_plot_display_info(struct graph_info *ginfo, struct graph_plot *plot,
427 trace_seq_putc(s, '\n'); 435 trace_seq_putc(s, '\n');
428 pevent_event_info(s, event, record); 436 pevent_event_info(s, event, record);
429 trace_seq_putc(s, '\n'); 437 trace_seq_putc(s, '\n');
438 if (!is_running)
439 trace_seq_putc(s, '\n');
430 } else 440 } else
431 trace_seq_printf(s, "UNKNOWN EVENT %d\n", eid); 441 trace_seq_printf(s, "UNKNOWN EVENT %d\n", eid);
432 } 442 }
@@ -554,9 +564,16 @@ void rt_plot_cpu(struct graph_info *ginfo, int cpu)
554 rtc_info->cpu = cpu; 564 rtc_info->cpu = cpu;
555 rtc_info->label = malloc_or_die(LLABEL); 565 rtc_info->label = malloc_or_die(LLABEL);
556 566
557 snprintf(label, 100, "*CPU %d", cpu); 567 snprintf(label, 100, "RT-CPU %d", cpu);
558 568
559 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU, 569 plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU,
560 TIME_TYPE_RT, &rt_cpu_cb, rtc_info); 570 TIME_TYPE_RT, &rt_cpu_cb, rtc_info);
561 trace_graph_plot_add_all_recs(ginfo, plot); 571 trace_graph_plot_add_all_recs(ginfo, plot);
562} 572}
573
574void rt_plot_init_cpus(struct graph_info *ginfo, int cpus)
575{
576 long cpu;
577 for (cpu = 0; cpu < cpus; cpu++)
578 rt_plot_cpu(ginfo, cpu);
579}
diff --git a/rt-plot-cpu.h b/rt-plot-cpu.h
index eb63167..4af978d 100644
--- a/rt-plot-cpu.h
+++ b/rt-plot-cpu.h
@@ -17,5 +17,6 @@ void rt_plot_cpus_update_callback(gboolean accept,
17 gboolean all_cpus, 17 gboolean all_cpus,
18 guint64 *selected_cpu_mask, 18 guint64 *selected_cpu_mask,
19 gpointer data); 19 gpointer data);
20void rt_plot_init_cpus(struct graph_info *ginfo, int cpus);
20 21
21#endif 22#endif
diff --git a/rt-plot-task.c b/rt-plot-task.c
index 7132fb2..a5b475f 100644
--- a/rt-plot-task.c
+++ b/rt-plot-task.c
@@ -832,3 +832,12 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos)
832 free(plot_label); 832 free(plot_label);
833 trace_graph_plot_add_all_recs(ginfo, plot); 833 trace_graph_plot_add_all_recs(ginfo, plot);
834} 834}
835
836void rt_plot_add_all_tasks(struct graph_info *ginfo)
837{
838 gint *tasks;
839 int i;
840 tasks = task_list_pids(ginfo->rtg_info.tasks);
841 for (i = 0; tasks[i] != -1; i++)
842 rt_plot_task(ginfo, tasks[i], ginfo->plots);
843}
diff --git a/rt-plot-task.h b/rt-plot-task.h
index ccbd208..a61a2b7 100644
--- a/rt-plot-task.h
+++ b/rt-plot-task.h
@@ -29,4 +29,6 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos);
29void rt_plot_tasks_plotted(struct graph_info *ginfo, gint **plotted); 29void rt_plot_tasks_plotted(struct graph_info *ginfo, gint **plotted);
30void rt_plot_task_update_callback(gboolean accept, gint *selected, 30void rt_plot_task_update_callback(gboolean accept, gint *selected,
31 gint *non_select, gpointer data); 31 gint *non_select, gpointer data);
32void rt_plot_add_all_tasks(struct graph_info *ginfo);
33
32#endif 34#endif
diff --git a/trace-graph.c b/trace-graph.c
index 42a0b27..76420d6 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -55,7 +55,7 @@
55#define PLOT_GIVE 2 55#define PLOT_GIVE 2
56#define PLOT_BEGIN 80 56#define PLOT_BEGIN 80
57#define PLOT_SEP 50 57#define PLOT_SEP 50
58#define MAX_TRI_TIME 50000000 58#define MAX_TRI_TIME 20000000
59#define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE) 59#define PLOT_LINE(plot) (PLOT_SEP * (plot) + PLOT_BEGIN + PLOT_SIZE)
60#define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2) 60#define PLOT_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE * 2)
61#define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE) 61#define PLOT_BOX_TOP(plot) (PLOT_LINE(plot) - PLOT_SIZE)
@@ -92,6 +92,12 @@ static int convert_dist_to_time(struct graph_info *ginfo, int dist)
92 return convert_x_to_time(ginfo, dist) - convert_x_to_time(ginfo, 0); 92 return convert_x_to_time(ginfo, dist) - convert_x_to_time(ginfo, 0);
93} 93}
94 94
95static int is_high_res(struct graph_info *ginfo)
96{
97 return convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME;
98}
99
100
95static void print_time(unsigned long long time) 101static void print_time(unsigned long long time)
96{ 102{
97 unsigned long sec, usec; 103 unsigned long sec, usec;
@@ -126,7 +132,6 @@ static void init_event_cache(struct graph_info *ginfo)
126 * it into the pevent command line list. 132 * it into the pevent command line list.
127 */ 133 */
128 ginfo->read_comms = TRUE; 134 ginfo->read_comms = TRUE;
129
130 init_rt_event_cache(&ginfo->rtg_info); 135 init_rt_event_cache(&ginfo->rtg_info);
131} 136}
132 137
@@ -1642,7 +1647,7 @@ static gint draw_plot_line(struct graph_info *ginfo, int i,
1642 /* y = (small) ? PLOT_BOX_TOP(i) : PLOT_TOP(i); */ 1647 /* y = (small) ? PLOT_BOX_TOP(i) : PLOT_TOP(i); */
1643 y = PLOT_TOP(i); 1648 y = PLOT_TOP(i);
1644 1649
1645 if (!small || convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { 1650 if (!small || is_high_res(ginfo)) {
1646 gdk_draw_line(ginfo->curr_pixmap, gc, 1651 gdk_draw_line(ginfo->curr_pixmap, gc,
1647 x, y, x, PLOT_BOTTOM(i)); 1652 x, y, x, PLOT_BOTTOM(i));
1648 } 1653 }
@@ -1691,6 +1696,14 @@ static void draw_plot_box(struct graph_info *ginfo, int i,
1691 fill, 1696 fill,
1692 x1, y, 1697 x1, y,
1693 x2 - x1, size); 1698 x2 - x1, size);
1699 if (is_high_res(ginfo)) {
1700 gdk_draw_rectangle(ginfo->curr_pixmap,
1701 ginfo->draw->style->black_gc,
1702 FALSE,
1703 x1, y,
1704 x2 - x1, size);
1705 }
1706
1694 if (label) 1707 if (label)
1695 draw_plot_label(ginfo, label, x1 + 1, y + 1, x2 - x1 - 2); 1708 draw_plot_label(ginfo, label, x1 + 1, y + 1, x2 - x1 - 2);
1696} 1709}
@@ -1709,11 +1722,9 @@ static void draw_plot_release(struct graph_info *ginfo, int i,
1709 tpoints[2].x = x + PLOT_TRI_SIZE/2; 1722 tpoints[2].x = x + PLOT_TRI_SIZE/2;
1710 tpoints[2].y = tbase; 1723 tpoints[2].y = tbase;
1711 1724
1712 if (convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { 1725 gdk_draw_line(ginfo->curr_pixmap, gc,
1713 gdk_draw_line(ginfo->curr_pixmap, gc, 1726 x, tbase, x, PLOT_BOX_BOTTOM(i));
1714 x, tbase, x, PLOT_BOX_BOTTOM(i)); 1727 gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3);
1715 gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3);
1716 }
1717} 1728}
1718 1729
1719static void draw_plot_deadline(struct graph_info *ginfo, int i, 1730static void draw_plot_deadline(struct graph_info *ginfo, int i,
@@ -1729,11 +1740,9 @@ static void draw_plot_deadline(struct graph_info *ginfo, int i,
1729 tpoints[2].x = x + PLOT_TRI_SIZE/2; 1740 tpoints[2].x = x + PLOT_TRI_SIZE/2;
1730 tpoints[2].y = tbase; 1741 tpoints[2].y = tbase;
1731 1742
1732 if (convert_dist_to_time(ginfo, PLOT_TRI_SIZE) < MAX_TRI_TIME) { 1743 gdk_draw_line(ginfo->curr_pixmap, gc,
1733 gdk_draw_line(ginfo->curr_pixmap, gc, 1744 x, PLOT_BOX_TOP(i), x, tbase);
1734 x, PLOT_BOX_TOP(i), x, tbase); 1745 gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3);
1735 gdk_draw_polygon(ginfo->curr_pixmap, gc, FALSE, tpoints, 3);
1736 }
1737} 1746}
1738 1747
1739static void draw_plot_completion(struct graph_info *ginfo, int i, 1748static void draw_plot_completion(struct graph_info *ginfo, int i,
@@ -1749,9 +1758,7 @@ static void draw_plot_completion(struct graph_info *ginfo, int i,
1749 tpoints[2].x = x + PLOT_BTRI_SIZE/2; 1758 tpoints[2].x = x + PLOT_BTRI_SIZE/2;
1750 tpoints[2].y = tbase; 1759 tpoints[2].y = tbase;
1751 1760
1752 if (convert_dist_to_time(ginfo, PLOT_BTRI_SIZE) < MAX_TRI_TIME) { 1761 gdk_draw_polygon(ginfo->curr_pixmap, gc, TRUE, tpoints, 3);
1753 gdk_draw_polygon(ginfo->curr_pixmap, gc, TRUE, tpoints, 3);
1754 }
1755} 1762}
1756 1763
1757static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, 1764static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
@@ -1790,7 +1797,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
1790 info.bfill, info.bthin, info.blabel, plot->gc); 1797 info.bfill, info.bthin, info.blabel, plot->gc);
1791 } 1798 }
1792 1799
1793 if (info.release) { 1800 if (info.release && is_high_res(ginfo)) {
1794 if (plot->last_color != 0) { 1801 if (plot->last_color != 0) {
1795 plot->last_color = 0; 1802 plot->last_color = 0;
1796 set_color(ginfo->draw, plot->gc, plot->last_color); 1803 set_color(ginfo->draw, plot->gc, plot->last_color);
@@ -1798,7 +1805,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
1798 draw_plot_release(ginfo, plot->pos, info.rtime, plot->gc); 1805 draw_plot_release(ginfo, plot->pos, info.rtime, plot->gc);
1799 } 1806 }
1800 1807
1801 if (info.deadline) { 1808 if (info.deadline && is_high_res(ginfo)) {
1802 if (plot->last_color != 0) { 1809 if (plot->last_color != 0) {
1803 plot->last_color = 0; 1810 plot->last_color = 0;
1804 set_color(ginfo->draw, plot->gc, plot->last_color); 1811 set_color(ginfo->draw, plot->gc, plot->last_color);
@@ -1806,7 +1813,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
1806 draw_plot_deadline(ginfo, plot->pos, info.dtime, plot->gc); 1813 draw_plot_deadline(ginfo, plot->pos, info.dtime, plot->gc);
1807 } 1814 }
1808 1815
1809 if (info.completion) { 1816 if (info.completion && is_high_res(ginfo)) {
1810 if (plot->last_color != 0) { 1817 if (plot->last_color != 0) {
1811 plot->last_color = 0; 1818 plot->last_color = 0;
1812 set_color(ginfo->draw, plot->gc, plot->last_color); 1819 set_color(ginfo->draw, plot->gc, plot->last_color);
@@ -1924,8 +1931,6 @@ static void draw_plots(struct graph_info *ginfo, gint new_width)
1924 gint cpu; 1931 gint cpu;
1925 gint i; 1932 gint i;
1926 1933
1927 printf("----Drawing plots----\n");
1928
1929 /* Initialize plots */ 1934 /* Initialize plots */
1930 for (i = 0; i < ginfo->plots; i++) { 1935 for (i = 0; i < ginfo->plots; i++) {
1931 plot = ginfo->plot_array[i]; 1936 plot = ginfo->plot_array[i];
@@ -2502,7 +2507,7 @@ static int load_handle(struct graph_info *ginfo,
2502 ginfo->start_time = -1ULL; 2507 ginfo->start_time = -1ULL;
2503 ginfo->end_time = 0; 2508 ginfo->end_time = 0;
2504 2509
2505 graph_plot_init_cpus(ginfo, ginfo->cpus); 2510 rt_plot_init_cpus(ginfo, ginfo->cpus);
2506 2511
2507 ginfo->draw_height = PLOT_SPACE(ginfo->plots); 2512 ginfo->draw_height = PLOT_SPACE(ginfo->plots);
2508 2513
@@ -2549,7 +2554,6 @@ void trace_graph_refresh(struct graph_info *ginfo)
2549 ginfo->draw_height = PLOT_SPACE(ginfo->plots); 2554 ginfo->draw_height = PLOT_SPACE(ginfo->plots);
2550 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height); 2555 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height);
2551 update_label_window(ginfo); 2556 update_label_window(ginfo);
2552 printf("----Redrawing graph----\n");
2553 redraw_graph(ginfo); 2557 redraw_graph(ginfo);
2554} 2558}
2555 2559