diff options
Diffstat (limited to 'trace-graph.c')
-rw-r--r-- | trace-graph.c | 82 |
1 files changed, 36 insertions, 46 deletions
diff --git a/trace-graph.c b/trace-graph.c index 66c2722..0b2b7cf 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -1149,8 +1149,9 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot, | |||
1149 | 1149 | ||
1150 | trace_seq_init(&s); | 1150 | trace_seq_init(&s); |
1151 | 1151 | ||
1152 | dprintf(3, "start=%llu end=%llu time=%llu\n", | 1152 | dprintf(3, "start=%llu end=%llu time=%llu, vstart: %llu, vend: %llu\n", |
1153 | (u64)ginfo->start_time, (u64)ginfo->end_time, (u64)time); | 1153 | (u64)ginfo->start_time, (u64)ginfo->end_time, (u64)time, |
1154 | (u64)ginfo->view_start_time, (u64)ginfo->view_end_time); | ||
1154 | 1155 | ||
1155 | if (!trace_graph_plot_display_info(ginfo, plot, &s, time)) { | 1156 | if (!trace_graph_plot_display_info(ginfo, plot, &s, time)) { |
1156 | /* Just display the current time */ | 1157 | /* Just display the current time */ |
@@ -1381,7 +1382,6 @@ static void zoom_in_window(struct graph_info *ginfo, gint start, gint end) | |||
1381 | dprintf(1, "*** ended with with "); | 1382 | dprintf(1, "*** ended with with "); |
1382 | print_time(convert_x_to_time(ginfo, ginfo->hadj_value)); | 1383 | print_time(convert_x_to_time(ginfo, ginfo->hadj_value)); |
1383 | dprintf(1, "\n"); | 1384 | dprintf(1, "\n"); |
1384 | |||
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | static gboolean | 1387 | static gboolean |
@@ -1859,32 +1859,43 @@ 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 | * TODO: this method needs refactoring | |
1864 | */ | ||
1864 | static void draw_hashed_plots(struct graph_info *ginfo) | 1865 | static void draw_hashed_plots(struct graph_info *ginfo) |
1865 | { | 1866 | { |
1866 | gint cpu, pid; | 1867 | gint cpu, pid, clean; |
1867 | struct record *record; | 1868 | struct record *record; |
1868 | struct plot_hash *hash; | 1869 | struct plot_hash *hash; |
1869 | struct plot_list *list; | 1870 | struct plot_list *list; |
1870 | unsigned long long old_start; | 1871 | unsigned long long old_start, max_time, min_time; |
1872 | gdouble duration, start; | ||
1873 | |||
1874 | start = ginfo->rtg_info.start_offset; | ||
1875 | duration = ginfo->rtg_info.duration; | ||
1876 | clean = ginfo->rtg_info.clean_records; | ||
1871 | 1877 | ||
1872 | set_cpus_to_rts(ginfo, ginfo->view_start_time); | 1878 | set_cpus_to_rts(ginfo, ginfo->view_start_time); |
1879 | |||
1880 | max_time = ginfo->view_end_time; | ||
1881 | min_time = ginfo->view_start_time; | ||
1873 | 1882 | ||
1874 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1883 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
1875 | int first = ginfo->rtg_info.start_time == 0; | 1884 | int first = ginfo->rtg_info.start_time == 0; |
1876 | if (get_rts(ginfo, record) < ginfo->view_start_time) { | 1885 | |
1886 | if (get_rts(ginfo, record) < min_time) { | ||
1877 | free_record(record); | 1887 | free_record(record); |
1878 | continue; | 1888 | continue; |
1879 | } | 1889 | } |
1880 | if (get_rts(ginfo, record) > ginfo->view_end_time) { | 1890 | |
1891 | if (get_rts(ginfo, record) > max_time) { | ||
1881 | free_record(record); | 1892 | free_record(record); |
1882 | break; | 1893 | break; |
1883 | } | 1894 | } |
1884 | 1895 | ||
1885 | // TODO: hack to clean up until first release, make unhacky | 1896 | // TODO: hack to clean up until first release, make unhacky |
1886 | if (ginfo->rtg_info.clean_records && | 1897 | if (ginfo->rtg_info.clean_records && |
1887 | (ginfo->rtg_info.start_time == 0 || ginfo->view_start_time < ginfo->rtg_info.start_time)) { | 1898 | (ginfo->rtg_info.start_time == 0 || get_rts(ginfo, record) < ginfo->rtg_info.start_time)) { |
1888 | unsigned long long dull, rel = 0; | 1899 | unsigned long long dull, rel = 0; |
1889 | char *dchar; | 1900 | char *dchar; |
1890 | int dint; | 1901 | int dint; |
@@ -1900,12 +1911,20 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1900 | rt_graph_check_server_param(ARG, &dint, &dull, &dull); | 1911 | rt_graph_check_server_param(ARG, &dint, &dull, &dull); |
1901 | #undef ARG | 1912 | #undef ARG |
1902 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { | 1913 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { |
1903 | dull = rel - .1 * (ginfo->view_end_time - rel); | 1914 | min_time = rel + ginfo->rtg_info.start_offset * NSECS_PER_SEC; |
1904 | ginfo->rtg_info.start_time = get_rts(ginfo, record); | 1915 | ginfo->rtg_info.start_time = min_time; |
1905 | //ginfo->view_end_time -= get_rts(ginfo, record) - ginfo->view_start_time; | 1916 | ginfo->view_start_time = min_time; |
1906 | ginfo->view_start_time = get_rts(ginfo, record); | 1917 | ginfo->start_time = min_time; |
1907 | if (first) | 1918 | |
1919 | if (ginfo->rtg_info.duration) { | ||
1920 | max_time = MIN(max_time, min_time + ginfo->rtg_info.duration * NSECS_PER_SEC); | ||
1921 | ginfo->view_end_time = max_time; | ||
1922 | ginfo->end_time = max_time; | ||
1923 | } | ||
1924 | if (first) { | ||
1925 | free_record(record); | ||
1908 | return; | 1926 | return; |
1927 | } | ||
1909 | } | 1928 | } |
1910 | 1929 | ||
1911 | free_record(record); | 1930 | free_record(record); |
@@ -1913,6 +1932,7 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1913 | continue; | 1932 | continue; |
1914 | } | 1933 | } |
1915 | 1934 | ||
1935 | |||
1916 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1936 | hash = trace_graph_plot_find_cpu(ginfo, cpu); |
1917 | if (hash) { | 1937 | if (hash) { |
1918 | for (list = hash->plots; list; list = list->next) { | 1938 | for (list = hash->plots; list; list = list->next) { |
@@ -1970,38 +1990,10 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
1970 | set_color(ginfo->draw, plot->gc, plot->last_color); | 1990 | set_color(ginfo->draw, plot->gc, plot->last_color); |
1971 | } | 1991 | } |
1972 | 1992 | ||
1973 | printf("we here1\n"); | ||
1974 | |||
1975 | trace_set_cursor(GDK_WATCH); | 1993 | trace_set_cursor(GDK_WATCH); |
1976 | /* /\* Shortcut if we don't have any task plots *\/ */ | ||
1977 | /* if (!ginfo->nr_task_hash && !ginfo->all_recs) { */ | ||
1978 | /* tracecmd_set_all_cpus_to_timestamp(ginfo->handle, */ | ||
1979 | /* ginfo->view_start_time); */ | ||
1980 | /* for (cpu = 0; cpu < ginfo->cpus; cpu++) { */ | ||
1981 | /* hash = trace_graph_plot_find_cpu(ginfo, cpu); */ | ||
1982 | /* if (!hash) */ | ||
1983 | /* continue; */ | ||
1984 | |||
1985 | /* while ((record = tracecmd_read_data(ginfo->handle, cpu))) { */ | ||
1986 | /* if (record->ts < ginfo->view_start_time) { */ | ||
1987 | /* free_record(record); */ | ||
1988 | /* continue; */ | ||
1989 | /* } */ | ||
1990 | /* if (record->ts > ginfo->view_end_time) { */ | ||
1991 | /* free_record(record); */ | ||
1992 | /* break; */ | ||
1993 | /* } */ | ||
1994 | /* for (list = hash->plots; list; list = list->next) */ | ||
1995 | /* draw_plot(ginfo, list->plot, record); */ | ||
1996 | /* free_record(record); */ | ||
1997 | /* } */ | ||
1998 | /* } */ | ||
1999 | /* goto out; */ | ||
2000 | /* } */ | ||
2001 | 1994 | ||
2002 | draw_hashed_plots(ginfo); | 1995 | draw_hashed_plots(ginfo); |
2003 | 1996 | ||
2004 | out: | ||
2005 | for (i = 0; i < ginfo->plots; i++) { | 1997 | for (i = 0; i < ginfo->plots; i++) { |
2006 | plot = ginfo->plot_array[i]; | 1998 | plot = ginfo->plot_array[i]; |
2007 | draw_plot(ginfo, plot, NULL); | 1999 | draw_plot(ginfo, plot, NULL); |
@@ -2010,6 +2002,7 @@ out: | |||
2010 | gdk_gc_unref(plot->gc); | 2002 | gdk_gc_unref(plot->gc); |
2011 | plot->gc = NULL; | 2003 | plot->gc = NULL; |
2012 | } | 2004 | } |
2005 | |||
2013 | trace_put_cursor(); | 2006 | trace_put_cursor(); |
2014 | } | 2007 | } |
2015 | 2008 | ||
@@ -2105,10 +2098,8 @@ static void draw_timeline(struct graph_info *ginfo, gint width) | |||
2105 | static void draw_info(struct graph_info *ginfo, | 2098 | static void draw_info(struct graph_info *ginfo, |
2106 | gint new_width) | 2099 | gint new_width) |
2107 | { | 2100 | { |
2108 | printf("we going?\n"); | ||
2109 | if (!ginfo->handle) | 2101 | if (!ginfo->handle) |
2110 | return; | 2102 | return; |
2111 | printf("we gone\n"); | ||
2112 | 2103 | ||
2113 | ginfo->resolution = (gdouble)new_width / (gdouble)(ginfo->view_end_time - | 2104 | ginfo->resolution = (gdouble)new_width / (gdouble)(ginfo->view_end_time - |
2114 | ginfo->view_start_time); | 2105 | ginfo->view_start_time); |
@@ -2117,7 +2108,6 @@ static void draw_info(struct graph_info *ginfo, | |||
2117 | 2108 | ||
2118 | draw_timeline(ginfo, new_width); | 2109 | draw_timeline(ginfo, new_width); |
2119 | 2110 | ||
2120 | printf("drawing plots\n"); | ||
2121 | draw_plots(ginfo, new_width); | 2111 | draw_plots(ginfo, new_width); |
2122 | 2112 | ||
2123 | ginfo->read_comms = FALSE; | 2113 | ginfo->read_comms = FALSE; |