aboutsummaryrefslogtreecommitdiffstats
path: root/trace-graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-graph.c')
-rw-r--r--trace-graph.c107
1 files changed, 77 insertions, 30 deletions
diff --git a/trace-graph.c b/trace-graph.c
index 2cf7a95..f3a5916 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -119,7 +119,7 @@ static void init_event_cache(struct graph_info *ginfo)
119 */ 119 */
120 ginfo->read_comms = TRUE; 120 ginfo->read_comms = TRUE;
121 121
122 init_rt_event_cache(&ginfo->rtinfo); 122 init_rt_event_cache(&ginfo->rtg_info);
123} 123}
124 124
125struct filter_task_item * 125struct filter_task_item *
@@ -1719,16 +1719,86 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot,
1719 plot->p1, plot->p2, ginfo->draw_width, width_16, font); 1719 plot->p1, plot->p2, ginfo->draw_width, width_16, font);
1720} 1720}
1721 1721
1722static void draw_nonrt_plots(struct graph_info *ginfo)
1723{
1724 gint cpu, pid;
1725 struct record *record;
1726 struct plot_hash *hash;
1727 struct plot_list *list;
1728
1729 tracecmd_set_all_cpus_to_timestamp(ginfo->handle,
1730 ginfo->view_start_time);
1731 while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) {
1732 if (record->ts < ginfo->view_start_time) {
1733 free_record(record);
1734 continue;
1735 }
1736 if (record->ts > ginfo->view_end_time) {
1737 free_record(record);
1738 break;
1739 }
1740 hash = trace_graph_plot_find_cpu(ginfo, cpu);
1741 if (hash) {
1742 for (list = hash->plots; list; list = list->next) {
1743 if (list->plot->type == PLOT_TYPE_RT_TASK)
1744 continue;
1745 draw_plot(ginfo, list->plot, record);
1746 }
1747 }
1748 pid = pevent_data_pid(ginfo->pevent, record);
1749 hash = trace_graph_plot_find_task(ginfo, pid);
1750 if (hash) {
1751 for (list = hash->plots; list; list = list->next) {
1752 if (list->plot->type == PLOT_TYPE_RT_TASK)
1753 continue;
1754 draw_plot(ginfo, list->plot, record);
1755 }
1756 }
1757 for (list = ginfo->all_recs; list; list = list->next) {
1758 if (list->plot->type == PLOT_TYPE_RT_TASK)
1759 continue;
1760 draw_plot(ginfo, list->plot, record);
1761 }
1762 free_record(record);
1763 }
1764}
1765
1766static void draw_rt_plots(struct graph_info *ginfo)
1767{
1768 gint cpu;
1769 struct record *record;
1770 struct plot_list *list;
1771
1772 set_cpus_to_rts(ginfo, ginfo->view_start_time);
1773 while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) {
1774 if (get_rts(ginfo, record) < ginfo->view_start_time) {
1775 free_record(record);
1776 continue;
1777 }
1778 if (get_rts(ginfo, record) > ginfo->view_end_time) {
1779 free_record(record);
1780 break;
1781 }
1782 for (list = ginfo->all_recs; list; list = list->next) {
1783 if (list->plot->type != PLOT_TYPE_RT_TASK)
1784 continue;
1785 draw_plot(ginfo, list->plot, record);
1786 }
1787 free_record(record);
1788 }
1789}
1790
1722static void draw_plots(struct graph_info *ginfo, gint new_width) 1791static void draw_plots(struct graph_info *ginfo, gint new_width)
1723{ 1792{
1724 struct plot_list *list; 1793 struct plot_list *list;
1725 struct graph_plot *plot; 1794 struct graph_plot *plot;
1726 struct record *record; 1795 struct record *record;
1727 struct plot_hash *hash; 1796 struct plot_hash *hash;
1728 gint pid;
1729 gint cpu; 1797 gint cpu;
1730 gint i; 1798 gint i;
1731 1799
1800 printf("----Drawing plots----\n");
1801
1732 /* Initialize plots */ 1802 /* Initialize plots */
1733 for (i = 0; i < ginfo->plots; i++) { 1803 for (i = 0; i < ginfo->plots; i++) {
1734 plot = ginfo->plot_array[i]; 1804 plot = ginfo->plot_array[i];
@@ -1748,13 +1818,11 @@ static void draw_plots(struct graph_info *ginfo, gint new_width)
1748 set_color(ginfo->draw, plot->gc, plot->last_color); 1818 set_color(ginfo->draw, plot->gc, plot->last_color);
1749 } 1819 }
1750 1820
1751 tracecmd_set_all_cpus_to_timestamp(ginfo->handle,
1752 ginfo->view_start_time);
1753
1754 trace_set_cursor(GDK_WATCH); 1821 trace_set_cursor(GDK_WATCH);
1755
1756 /* Shortcut if we don't have any task plots */ 1822 /* Shortcut if we don't have any task plots */
1757 if (!ginfo->nr_task_hash && !ginfo->all_recs) { 1823 if (!ginfo->nr_task_hash && !ginfo->all_recs) {
1824 tracecmd_set_all_cpus_to_timestamp(ginfo->handle,
1825 ginfo->view_start_time);
1758 for (cpu = 0; cpu < ginfo->cpus; cpu++) { 1826 for (cpu = 0; cpu < ginfo->cpus; cpu++) {
1759 hash = trace_graph_plot_find_cpu(ginfo, cpu); 1827 hash = trace_graph_plot_find_cpu(ginfo, cpu);
1760 if (!hash) 1828 if (!hash)
@@ -1777,30 +1845,8 @@ static void draw_plots(struct graph_info *ginfo, gint new_width)
1777 goto out; 1845 goto out;
1778 } 1846 }
1779 1847
1780 while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { 1848 draw_nonrt_plots(ginfo);
1781 if (record->ts < ginfo->view_start_time) { 1849 draw_rt_plots(ginfo);
1782 free_record(record);
1783 continue;
1784 }
1785 if (record->ts > ginfo->view_end_time) {
1786 free_record(record);
1787 break;
1788 }
1789 hash = trace_graph_plot_find_cpu(ginfo, cpu);
1790 if (hash) {
1791 for (list = hash->plots; list; list = list->next)
1792 draw_plot(ginfo, list->plot, record);
1793 }
1794 pid = pevent_data_pid(ginfo->pevent, record);
1795 hash = trace_graph_plot_find_task(ginfo, pid);
1796 if (hash) {
1797 for (list = hash->plots; list; list = list->next)
1798 draw_plot(ginfo, list->plot, record);
1799 }
1800 for (list = ginfo->all_recs; list; list = list->next)
1801 draw_plot(ginfo, list->plot, record);
1802 free_record(record);
1803 }
1804 1850
1805out: 1851out:
1806 for (i = 0; i < ginfo->plots; i++) { 1852 for (i = 0; i < ginfo->plots; i++) {
@@ -2376,6 +2422,7 @@ void trace_graph_refresh(struct graph_info *ginfo)
2376 ginfo->draw_height = PLOT_SPACE(ginfo->plots); 2422 ginfo->draw_height = PLOT_SPACE(ginfo->plots);
2377 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height); 2423 gtk_widget_set_size_request(ginfo->draw, ginfo->draw_width, ginfo->draw_height);
2378 update_label_window(ginfo); 2424 update_label_window(ginfo);
2425 printf("----Redrawing graph----\n");
2379 redraw_graph(ginfo); 2426 redraw_graph(ginfo);
2380} 2427}
2381 2428