diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | kernel-shark.c | 35 | ||||
-rw-r--r-- | rt-graph.h | 4 | ||||
-rw-r--r-- | rt-plot-task.c | 83 | ||||
-rw-r--r-- | trace-graph.c | 2 | ||||
-rw-r--r-- | trace-graph.h | 1 | ||||
-rw-r--r-- | trace-plot-task.c | 23 | ||||
-rw-r--r-- | trace-plot-task.h | 8 |
8 files changed, 113 insertions, 45 deletions
@@ -299,7 +299,7 @@ TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-hash.o trace-dialog.o \ | |||
299 | TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ | 299 | TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ |
300 | trace-stack.o trace-options.o | 300 | trace-stack.o trace-options.o |
301 | TRACE_VIEW_OBJS = trace-view.o trace-view-store.o | 301 | TRACE_VIEW_OBJS = trace-view.o trace-view-store.o |
302 | RT_GRAPH_OBJS = rt-graph.o rt-plot-task.o | 302 | RT_GRAPH_OBJS = rt-graph.o rt-plot-task.o rt-plot-cpu.o |
303 | TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o \ | 303 | TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o \ |
304 | trace-plot-cpu.o trace-plot-task.o \ | 304 | trace-plot-cpu.o trace-plot-task.o \ |
305 | $(RT_GRAPH_OBJS) task-list.o | 305 | $(RT_GRAPH_OBJS) task-list.o |
diff --git a/kernel-shark.c b/kernel-shark.c index 1aaf149..ca1fcb8 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
@@ -1245,6 +1245,25 @@ plot_cpu_clicked (gpointer data) | |||
1245 | g_free(cpu_mask); | 1245 | g_free(cpu_mask); |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | /* Callback for the clicked signal of the plot CPUs button */ | ||
1249 | static void | ||
1250 | plot_rt_cpu_clicked (gpointer data) | ||
1251 | { | ||
1252 | struct shark_info *info = data; | ||
1253 | struct graph_info *ginfo = info->ginfo; | ||
1254 | gboolean all_cpus; | ||
1255 | guint64 *cpu_mask; | ||
1256 | |||
1257 | if (!ginfo->handle) | ||
1258 | return; | ||
1259 | |||
1260 | rt_plot_cpus_plotted(ginfo, &all_cpus, &cpu_mask); | ||
1261 | |||
1262 | trace_filter_cpu_dialog(all_cpus, cpu_mask, ginfo->cpus, | ||
1263 | rt_plot_cpus_update_callback, ginfo); | ||
1264 | g_free(cpu_mask); | ||
1265 | } | ||
1266 | |||
1248 | /* Callback for the clicked signal of the plot tasks button */ | 1267 | /* Callback for the clicked signal of the plot tasks button */ |
1249 | static void | 1268 | static void |
1250 | plot_tasks_clicked (gpointer data) | 1269 | plot_tasks_clicked (gpointer data) |
@@ -1289,6 +1308,7 @@ plot_rt_tasks_clicked (gpointer data) | |||
1289 | free(selected); | 1308 | free(selected); |
1290 | } | 1309 | } |
1291 | 1310 | ||
1311 | |||
1292 | /* Callback for the clicked signal of the help contents button */ | 1312 | /* Callback for the clicked signal of the help contents button */ |
1293 | static void | 1313 | static void |
1294 | help_content_clicked (gpointer data) | 1314 | help_content_clicked (gpointer data) |
@@ -2211,6 +2231,21 @@ void kernel_shark(int argc, char **argv) | |||
2211 | /* We do need to show menu items */ | 2231 | /* We do need to show menu items */ |
2212 | gtk_widget_show(sub_item); | 2232 | gtk_widget_show(sub_item); |
2213 | 2233 | ||
2234 | /* --- Plot - RT CPUs Option --- */ | ||
2235 | |||
2236 | sub_item = gtk_menu_item_new_with_label("Real-Time CPUs"); | ||
2237 | |||
2238 | /* Add them to the menu */ | ||
2239 | gtk_menu_shell_append(GTK_MENU_SHELL (menu), sub_item); | ||
2240 | |||
2241 | /* We can attach the Quit menu item to our exit function */ | ||
2242 | g_signal_connect_swapped (G_OBJECT (sub_item), "activate", | ||
2243 | G_CALLBACK (plot_rt_cpu_clicked), | ||
2244 | (gpointer) info); | ||
2245 | |||
2246 | /* We do need to show menu items */ | ||
2247 | gtk_widget_show(sub_item); | ||
2248 | |||
2214 | 2249 | ||
2215 | /* --- End Plot Options --- */ | 2250 | /* --- End Plot Options --- */ |
2216 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); | 2251 | gtk_menu_item_set_submenu(GTK_MENU_ITEM (menu_item), menu); |
@@ -5,6 +5,10 @@ | |||
5 | #include "task-list.h" | 5 | #include "task-list.h" |
6 | #include "trace-cmd.h" | 6 | #include "trace-cmd.h" |
7 | #include "rt-plot-task.h" | 7 | #include "rt-plot-task.h" |
8 | #include "rt-plot-cpu.h" | ||
9 | |||
10 | #define LLABEL 30 | ||
11 | #define SEARCH_PERIODS 3 | ||
8 | 12 | ||
9 | #define NO_CPU -1 | 13 | #define NO_CPU -1 |
10 | 14 | ||
diff --git a/rt-plot-task.c b/rt-plot-task.c index 852f323..48bcdde 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -1,10 +1,7 @@ | |||
1 | #include "trace-graph.h" | 1 | #include "trace-graph.h" |
2 | #include "trace-filter.h" | 2 | #include "trace-filter.h" |
3 | 3 | ||
4 | #define LLABEL 30 | 4 | #define DEBUG_LEVEL 0 |
5 | #define SEARCH_PERIODS 3 | ||
6 | |||
7 | #define DEBUG_LEVEL 3 | ||
8 | #if DEBUG_LEVEL > 0 | 5 | #if DEBUG_LEVEL > 0 |
9 | #define dprintf(l, x...) \ | 6 | #define dprintf(l, x...) \ |
10 | do { \ | 7 | do { \ |
@@ -59,12 +56,10 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
59 | max_ts = ginfo->view_end_time + | 56 | max_ts = ginfo->view_end_time + |
60 | SEARCH_PERIODS * rtg_info->max_period; | 57 | SEARCH_PERIODS * rtg_info->max_period; |
61 | set_cpus_to_rts(ginfo, time); | 58 | set_cpus_to_rts(ginfo, time); |
62 | do { | 59 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
63 | free_record(record); | 60 | if (get_rts(ginfo, record) > max_ts) { |
64 | record = tracecmd_read_next_data(ginfo->handle, &cpu); | ||
65 | if (!record || get_rts(ginfo, record) > max_ts) { | ||
66 | free_record(record); | 61 | free_record(record); |
67 | goto out; | 62 | break; |
68 | } | 63 | } |
69 | 64 | ||
70 | /* Sorry mother */ | 65 | /* Sorry mother */ |
@@ -79,10 +74,10 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
79 | if (eid && pid == rtt_info->pid) { | 74 | if (eid && pid == rtt_info->pid) { |
80 | ret = record; | 75 | ret = record; |
81 | *out_eid = eid; | 76 | *out_eid = eid; |
82 | goto out; | 77 | break; |
83 | } | 78 | } |
84 | } while (get_rts(ginfo, record) < max_ts); | 79 | free_record(record); |
85 | out: | 80 | }; |
86 | return ret; | 81 | return ret; |
87 | } | 82 | } |
88 | 83 | ||
@@ -561,8 +556,9 @@ static void rt_task_plot_destroy(struct graph_info *ginfo, struct graph_plot *pl | |||
561 | { | 556 | { |
562 | struct rt_task_info *rtt_info = plot->private; | 557 | struct rt_task_info *rtt_info = plot->private; |
563 | dprintf(4,"%s\n", __FUNCTION__); | 558 | dprintf(4,"%s\n", __FUNCTION__); |
559 | trace_graph_plot_remove_all_recs(ginfo, plot); | ||
564 | free(rtt_info->label); | 560 | free(rtt_info->label); |
565 | task_plot_destroy(ginfo, plot); | 561 | free(rtt_info); |
566 | } | 562 | } |
567 | 563 | ||
568 | static int rt_task_plot_display_last_event(struct graph_info *ginfo, | 564 | static int rt_task_plot_display_last_event(struct graph_info *ginfo, |
@@ -716,8 +712,61 @@ void rt_plot_task_update_callback(gboolean accept, | |||
716 | gint *non_select, | 712 | gint *non_select, |
717 | gpointer data) | 713 | gpointer data) |
718 | { | 714 | { |
719 | graph_tasks_update_callback(PLOT_TYPE_RT_TASK, rt_plot_task, | 715 | struct graph_info *ginfo = data; |
720 | accept, selected, non_select, data); | 716 | struct rt_task_info *rtt_info; |
717 | struct graph_plot *plot; | ||
718 | gint select_size = 0; | ||
719 | gint *ptr; | ||
720 | int i; | ||
721 | |||
722 | if (!accept) | ||
723 | return; | ||
724 | |||
725 | /* The selected and non_select are sorted */ | ||
726 | if (selected) { | ||
727 | for (i = 0; selected[i] >= 0; i++) | ||
728 | ; | ||
729 | select_size = i; | ||
730 | } | ||
731 | |||
732 | /* | ||
733 | * Remove and add task plots. | ||
734 | * Go backwards, since removing a plot shifts the | ||
735 | * array from current position back. | ||
736 | */ | ||
737 | for (i = ginfo->plots - 1; i >= 0; i--) { | ||
738 | plot = ginfo->plot_array[i]; | ||
739 | if (plot->type != PLOT_TYPE_RT_TASK) | ||
740 | continue; | ||
741 | rtt_info = plot->private; | ||
742 | |||
743 | /* If non are selected, then remove all */ | ||
744 | if (!select_size) { | ||
745 | trace_graph_plot_remove(ginfo, plot); | ||
746 | continue; | ||
747 | } | ||
748 | ptr = bsearch(&rtt_info->pid, selected, select_size, | ||
749 | sizeof(gint), id_cmp); | ||
750 | if (ptr) { | ||
751 | /* | ||
752 | * This plot plot already exists, remove it | ||
753 | * from the selected array. | ||
754 | */ | ||
755 | memmove(ptr, ptr + 1, | ||
756 | (unsigned long)(selected + select_size) - | ||
757 | (unsigned long)(ptr + 1)); | ||
758 | select_size--; | ||
759 | continue; | ||
760 | } | ||
761 | /* Remove the plot */ | ||
762 | trace_graph_plot_remove(ginfo, plot); | ||
763 | } | ||
764 | |||
765 | /* Now add any plots that need to be added */ | ||
766 | for (i = 0; i < select_size; i++) | ||
767 | rt_plot_task(ginfo, selected[i], ginfo->plots); | ||
768 | |||
769 | trace_graph_refresh(ginfo); | ||
721 | } | 770 | } |
722 | 771 | ||
723 | void rt_plot_task_plotted(struct graph_info *ginfo, gint **plotted) | 772 | void rt_plot_task_plotted(struct graph_info *ginfo, gint **plotted) |
@@ -774,9 +823,5 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
774 | TIME_TYPE_RT, | 823 | TIME_TYPE_RT, |
775 | &rt_task_cb, rtt_info); | 824 | &rt_task_cb, rtt_info); |
776 | free(plot_label); | 825 | free(plot_label); |
777 | |||
778 | printf("Created plot for %s-%d / %d %p\n", comm, pid, rtt_info->pid, | ||
779 | rtt_info); | ||
780 | |||
781 | trace_graph_plot_add_all_recs(ginfo, plot); | 826 | trace_graph_plot_add_all_recs(ginfo, plot); |
782 | } | 827 | } |
diff --git a/trace-graph.c b/trace-graph.c index 34c8268..5c364e4 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -1846,6 +1846,7 @@ static void draw_ft_plots(struct graph_info *ginfo) | |||
1846 | struct plot_hash *hash; | 1846 | struct plot_hash *hash; |
1847 | struct plot_list *list; | 1847 | struct plot_list *list; |
1848 | 1848 | ||
1849 | |||
1849 | tracecmd_set_all_cpus_to_timestamp(ginfo->handle, | 1850 | tracecmd_set_all_cpus_to_timestamp(ginfo->handle, |
1850 | ginfo->view_start_time); | 1851 | ginfo->view_start_time); |
1851 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1852 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
@@ -1874,6 +1875,7 @@ static void draw_ft_plots(struct graph_info *ginfo) | |||
1874 | draw_plot(ginfo, list->plot, record); | 1875 | draw_plot(ginfo, list->plot, record); |
1875 | } | 1876 | } |
1876 | } | 1877 | } |
1878 | int stuff = 0; | ||
1877 | for (list = ginfo->all_recs; list; list = list->next) { | 1879 | for (list = ginfo->all_recs; list; list = list->next) { |
1878 | if (list->plot->time != TIME_TYPE_FT) | 1880 | if (list->plot->time != TIME_TYPE_FT) |
1879 | continue; | 1881 | continue; |
diff --git a/trace-graph.h b/trace-graph.h index cfa5db7..ffd7cf5 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
@@ -42,6 +42,7 @@ enum graph_plot_type { | |||
42 | PLOT_TYPE_CPU, | 42 | PLOT_TYPE_CPU, |
43 | PLOT_TYPE_TASK, | 43 | PLOT_TYPE_TASK, |
44 | PLOT_TYPE_RT_TASK, | 44 | PLOT_TYPE_RT_TASK, |
45 | PLOT_TYPE_RT_CPU, | ||
45 | }; | 46 | }; |
46 | 47 | ||
47 | enum plot_time_type { | 48 | enum plot_time_type { |
diff --git a/trace-plot-task.c b/trace-plot-task.c index 803d89b..096b792 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c | |||
@@ -739,12 +739,10 @@ void graph_plot_task_plotted(struct graph_info *ginfo, | |||
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | void graph_tasks_update_callback(enum graph_plot_type type, | 742 | void graph_plot_task_update_callback(gboolean accept, |
743 | plot_task_cb plot_cb, | 743 | gint *selected, |
744 | gboolean accept, | 744 | gint *non_select, |
745 | gint *selected, | 745 | gpointer data) |
746 | gint *non_select, | ||
747 | gpointer data) | ||
748 | { | 746 | { |
749 | struct graph_info *ginfo = data; | 747 | struct graph_info *ginfo = data; |
750 | struct task_plot_info *task_info; | 748 | struct task_plot_info *task_info; |
@@ -770,7 +768,7 @@ void graph_tasks_update_callback(enum graph_plot_type type, | |||
770 | */ | 768 | */ |
771 | for (i = ginfo->plots - 1; i >= 0; i--) { | 769 | for (i = ginfo->plots - 1; i >= 0; i--) { |
772 | plot = ginfo->plot_array[i]; | 770 | plot = ginfo->plot_array[i]; |
773 | if (plot->type != type) | 771 | if (plot->type != PLOT_TYPE_TASK) |
774 | continue; | 772 | continue; |
775 | task_info = plot->private; | 773 | task_info = plot->private; |
776 | 774 | ||
@@ -798,20 +796,11 @@ void graph_tasks_update_callback(enum graph_plot_type type, | |||
798 | 796 | ||
799 | /* Now add any plots that need to be added */ | 797 | /* Now add any plots that need to be added */ |
800 | for (i = 0; i < select_size; i++) | 798 | for (i = 0; i < select_size; i++) |
801 | plot_cb(ginfo, selected[i], ginfo->plots); | 799 | graph_plot_task(ginfo, selected[i], ginfo->plots); |
802 | 800 | ||
803 | trace_graph_refresh(ginfo); | 801 | trace_graph_refresh(ginfo); |
804 | } | 802 | } |
805 | 803 | ||
806 | void graph_plot_task_update_callback(gboolean accept, | ||
807 | gint *selected, | ||
808 | gint *non_select, | ||
809 | gpointer data) | ||
810 | { | ||
811 | graph_tasks_update_callback(PLOT_TYPE_TASK, graph_plot_task, | ||
812 | accept, selected, non_select, data); | ||
813 | } | ||
814 | |||
815 | void graph_plot_init_tasks(struct graph_info *ginfo) | 804 | void graph_plot_init_tasks(struct graph_info *ginfo) |
816 | { | 805 | { |
817 | struct task_plot_info *task_info; | 806 | struct task_plot_info *task_info; |
diff --git a/trace-plot-task.h b/trace-plot-task.h index 11cb4f8..e5b9346 100644 --- a/trace-plot-task.h +++ b/trace-plot-task.h | |||
@@ -86,12 +86,4 @@ void graph_plot_task_update_callback(gboolean accept, | |||
86 | 86 | ||
87 | void graph_plot_init_tasks(struct graph_info *ginfo); | 87 | void graph_plot_init_tasks(struct graph_info *ginfo); |
88 | 88 | ||
89 | /* Shared functionality for inheriting structs */ | ||
90 | typedef void (plot_task_cb)(struct graph_info *ginfo, int pid, int pos); | ||
91 | void graph_tasks_update_callback(enum graph_plot_type type, | ||
92 | plot_task_cb plot_cb, | ||
93 | gboolean accept, | ||
94 | gint *selected, | ||
95 | gint *non_select, | ||
96 | gpointer data); | ||
97 | #endif | 89 | #endif |