diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-30 17:52:36 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-30 17:52:36 -0400 |
commit | bd785a74d55010269548cb1d05740643e96a321d (patch) | |
tree | cb4b70d582337b2b495f08e0032d0cecd89f087b | |
parent | 129f97bd91c3f971ee4c3d09264efca1384bd9b6 (diff) |
Sort inserted real time tasks
-rw-r--r-- | rt-plot-task.c | 16 | ||||
-rw-r--r-- | trace-graph.c | 68 |
2 files changed, 47 insertions, 37 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c index 6e0013d..afb2bef 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -677,8 +677,20 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
677 | void rt_plot_add_all_tasks(struct graph_info *ginfo) | 677 | void rt_plot_add_all_tasks(struct graph_info *ginfo) |
678 | { | 678 | { |
679 | gint *tasks; | 679 | gint *tasks; |
680 | int i; | 680 | int i, j, len, tmp; |
681 | tasks = task_list_pids(ginfo->rtg_info.tasks); | 681 | tasks = task_list_pids(ginfo->rtg_info.tasks); |
682 | for (i = 0; tasks[i] != -1; i++) | 682 | |
683 | for (i = 0; tasks[i] != -1; ++i) { | ||
684 | for (j = i; tasks[j] != -1; ++j) { | ||
685 | if (tasks[i] > tasks[j]) { | ||
686 | tmp = tasks[i]; | ||
687 | tasks[i] = tasks[j]; | ||
688 | tasks[j] = tmp; | ||
689 | } | ||
690 | } | ||
691 | } | ||
692 | |||
693 | for (i = 0; tasks[i] != -1; ++i) { | ||
683 | rt_plot_task(ginfo, tasks[i], ginfo->plots); | 694 | rt_plot_task(ginfo, tasks[i], ginfo->plots); |
695 | } | ||
684 | } | 696 | } |
diff --git a/trace-graph.c b/trace-graph.c index f843e26..2ad32a8 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -1859,6 +1859,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1859 | plot->p1, plot->p2, ginfo->draw_width, width_16, font); | 1859 | plot->p1, plot->p2, ginfo->draw_width, width_16, font); |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | int tries = 0; | ||
1862 | 1863 | ||
1863 | static void draw_hashed_plots(struct graph_info *ginfo) | 1864 | static void draw_hashed_plots(struct graph_info *ginfo) |
1864 | { | 1865 | { |
@@ -1870,6 +1871,7 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1870 | set_cpus_to_rts(ginfo, ginfo->view_start_time); | 1871 | set_cpus_to_rts(ginfo, ginfo->view_start_time); |
1871 | 1872 | ||
1872 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1873 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
1874 | int first = ginfo->rtg_info.start_time == 0; | ||
1873 | if (get_rts(ginfo, record) < ginfo->view_start_time) { | 1875 | if (get_rts(ginfo, record) < ginfo->view_start_time) { |
1874 | free_record(record); | 1876 | free_record(record); |
1875 | continue; | 1877 | continue; |
@@ -1898,11 +1900,14 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1898 | #undef ARG | 1900 | #undef ARG |
1899 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { | 1901 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { |
1900 | dull = rel - .1 * (ginfo->view_end_time - rel);; | 1902 | dull = rel - .1 * (ginfo->view_end_time - rel);; |
1901 | ginfo->rtg_info.start_time = dull; | 1903 | ginfo->rtg_info.start_time = get_rts(ginfo, record); |
1902 | ginfo->view_start_time = dull; | 1904 | ginfo->view_start_time = get_rts(ginfo, record); |
1905 | if (first) | ||
1906 | return; | ||
1903 | } | 1907 | } |
1904 | 1908 | ||
1905 | free_record(record); | 1909 | free_record(record); |
1910 | |||
1906 | continue; | 1911 | continue; |
1907 | } | 1912 | } |
1908 | 1913 | ||
@@ -1966,33 +1971,31 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
1966 | printf("we here1\n"); | 1971 | printf("we here1\n"); |
1967 | 1972 | ||
1968 | trace_set_cursor(GDK_WATCH); | 1973 | trace_set_cursor(GDK_WATCH); |
1969 | /* Shortcut if we don't have any task plots */ | 1974 | /* /\* Shortcut if we don't have any task plots *\/ */ |
1970 | if (!ginfo->nr_task_hash && !ginfo->all_recs) { | 1975 | /* if (!ginfo->nr_task_hash && !ginfo->all_recs) { */ |
1971 | tracecmd_set_all_cpus_to_timestamp(ginfo->handle, | 1976 | /* tracecmd_set_all_cpus_to_timestamp(ginfo->handle, */ |
1972 | ginfo->view_start_time); | 1977 | /* ginfo->view_start_time); */ |
1973 | for (cpu = 0; cpu < ginfo->cpus; cpu++) { | 1978 | /* for (cpu = 0; cpu < ginfo->cpus; cpu++) { */ |
1974 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1979 | /* hash = trace_graph_plot_find_cpu(ginfo, cpu); */ |
1975 | if (!hash) | 1980 | /* if (!hash) */ |
1976 | continue; | 1981 | /* continue; */ |
1977 | 1982 | ||
1978 | while ((record = tracecmd_read_data(ginfo->handle, cpu))) { | 1983 | /* while ((record = tracecmd_read_data(ginfo->handle, cpu))) { */ |
1979 | if (record->ts < ginfo->view_start_time) { | 1984 | /* if (record->ts < ginfo->view_start_time) { */ |
1980 | free_record(record); | 1985 | /* free_record(record); */ |
1981 | continue; | 1986 | /* continue; */ |
1982 | } | 1987 | /* } */ |
1983 | if (record->ts > ginfo->view_end_time) { | 1988 | /* if (record->ts > ginfo->view_end_time) { */ |
1984 | free_record(record); | 1989 | /* free_record(record); */ |
1985 | break; | 1990 | /* break; */ |
1986 | } | 1991 | /* } */ |
1987 | for (list = hash->plots; list; list = list->next) | 1992 | /* for (list = hash->plots; list; list = list->next) */ |
1988 | draw_plot(ginfo, list->plot, record); | 1993 | /* draw_plot(ginfo, list->plot, record); */ |
1989 | free_record(record); | 1994 | /* free_record(record); */ |
1990 | } | 1995 | /* } */ |
1991 | } | 1996 | /* } */ |
1992 | goto out; | 1997 | /* goto out; */ |
1993 | } | 1998 | /* } */ |
1994 | |||
1995 | printf("we here\n"); | ||
1996 | 1999 | ||
1997 | draw_hashed_plots(ginfo); | 2000 | draw_hashed_plots(ginfo); |
1998 | 2001 | ||
@@ -2337,8 +2340,6 @@ static void redraw_pixmap_backend(struct graph_info *ginfo) | |||
2337 | } | 2340 | } |
2338 | } | 2341 | } |
2339 | 2342 | ||
2340 | static int tries = 0; | ||
2341 | |||
2342 | static gboolean | 2343 | static gboolean |
2343 | configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | 2344 | configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
2344 | { | 2345 | { |
@@ -2346,10 +2347,7 @@ configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | |||
2346 | 2347 | ||
2347 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); | 2348 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); |
2348 | 2349 | ||
2349 | // TODO: don't do this, compare widget to figure out if we should redraw | 2350 | redraw_pixmap_backend(ginfo); |
2350 | if (tries != 2) | ||
2351 | redraw_pixmap_backend(ginfo); | ||
2352 | ++tries; | ||
2353 | 2351 | ||
2354 | /* debug */ | 2352 | /* debug */ |
2355 | ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj); | 2353 | ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj); |