diff options
-rw-r--r-- | kernel-shark.c | 2 | ||||
-rw-r--r-- | trace-graph.c | 98 |
2 files changed, 47 insertions, 53 deletions
diff --git a/kernel-shark.c b/kernel-shark.c index df51c8d..416bf00 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
@@ -68,6 +68,7 @@ void usage(char *prog) | |||
68 | printf(" -c Ignore records before system release\n"); | 68 | printf(" -c Ignore records before system release\n"); |
69 | printf(" -s (float) Seconds after first record to begin displaying\n"); | 69 | printf(" -s (float) Seconds after first record to begin displaying\n"); |
70 | printf(" -d (float) Seconds of data to display\n"); | 70 | printf(" -d (float) Seconds of data to display\n"); |
71 | printf(" NOTE: -s and -d options currently require -c to be specified\n"); | ||
71 | } | 72 | } |
72 | 73 | ||
73 | static gboolean display_warnings; | 74 | static gboolean display_warnings; |
@@ -1835,7 +1836,6 @@ void kernel_shark(int argc, char **argv) | |||
1835 | int clean; | 1836 | int clean; |
1836 | double start = 0.0; | 1837 | double start = 0.0; |
1837 | double duration = 0.0; | 1838 | double duration = 0.0; |
1838 | |||
1839 | 1839 | ||
1840 | g_thread_init(NULL); | 1840 | g_thread_init(NULL); |
1841 | gdk_threads_init(); | 1841 | gdk_threads_init(); |
diff --git a/trace-graph.c b/trace-graph.c index 58baf79..6a7f1ff 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -721,7 +721,7 @@ do_pop_up(GtkWidget *widget, GdkEventButton *event, gpointer data) | |||
721 | gtk_widget_hide(menu_plot_task); | 721 | gtk_widget_hide(menu_plot_task); |
722 | } | 722 | } |
723 | 723 | ||
724 | 724 | ||
725 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, | 725 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 3, |
726 | gtk_get_current_event_time()); | 726 | gtk_get_current_event_time()); |
727 | 727 | ||
@@ -1072,7 +1072,6 @@ static void draw_info_box(struct graph_info *ginfo, const gchar *buffer, | |||
1072 | gint width, height; | 1072 | gint width, height; |
1073 | GdkPixmap *pix; | 1073 | GdkPixmap *pix; |
1074 | static GdkGC *pix_bg; | 1074 | static GdkGC *pix_bg; |
1075 | gint view_width; | ||
1076 | gint view_start; | 1075 | gint view_start; |
1077 | 1076 | ||
1078 | if (!pix_bg) { | 1077 | if (!pix_bg) { |
@@ -1093,7 +1092,6 @@ static void draw_info_box(struct graph_info *ginfo, const gchar *buffer, | |||
1093 | height += PLOT_BOARDER * 2; | 1092 | height += PLOT_BOARDER * 2; |
1094 | 1093 | ||
1095 | view_start = gtk_adjustment_get_value(ginfo->hadj); | 1094 | view_start = gtk_adjustment_get_value(ginfo->hadj); |
1096 | view_width = gtk_adjustment_get_page_size(ginfo->hadj); | ||
1097 | if (x > view_start + width) | 1095 | if (x > view_start + width) |
1098 | x -= width; | 1096 | x -= width; |
1099 | 1097 | ||
@@ -1117,7 +1115,7 @@ static void draw_info_box(struct graph_info *ginfo, const gchar *buffer, | |||
1117 | TRUE, | 1115 | TRUE, |
1118 | 0, 0, | 1116 | 0, 0, |
1119 | width, height); | 1117 | width, height); |
1120 | 1118 | ||
1121 | gdk_draw_rectangle(pix, | 1119 | gdk_draw_rectangle(pix, |
1122 | ginfo->draw->style->black_gc, | 1120 | ginfo->draw->style->black_gc, |
1123 | FALSE, | 1121 | FALSE, |
@@ -1137,7 +1135,6 @@ static void draw_info_box(struct graph_info *ginfo, const gchar *buffer, | |||
1137 | static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot, | 1135 | static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot, |
1138 | gint x, gint y) | 1136 | gint x, gint y) |
1139 | { | 1137 | { |
1140 | struct pevent *pevent; | ||
1141 | guint64 time; | 1138 | guint64 time; |
1142 | unsigned long sec, usec; | 1139 | unsigned long sec, usec; |
1143 | struct trace_seq s; | 1140 | struct trace_seq s; |
@@ -1145,8 +1142,6 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot, | |||
1145 | time = convert_x_to_time(ginfo, x); | 1142 | time = convert_x_to_time(ginfo, x); |
1146 | convert_nano(time, &sec, &usec); | 1143 | convert_nano(time, &sec, &usec); |
1147 | 1144 | ||
1148 | pevent = ginfo->pevent; | ||
1149 | |||
1150 | trace_seq_init(&s); | 1145 | trace_seq_init(&s); |
1151 | 1146 | ||
1152 | dprintf(3, "start=%llu end=%llu time=%llu, vstart: %llu, vend: %llu\n", | 1147 | dprintf(3, "start=%llu end=%llu time=%llu, vstart: %llu, vend: %llu\n", |
@@ -1168,7 +1163,6 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot, | |||
1168 | 1163 | ||
1169 | static void draw_latency(struct graph_info *ginfo, gint x, gint y) | 1164 | static void draw_latency(struct graph_info *ginfo, gint x, gint y) |
1170 | { | 1165 | { |
1171 | struct pevent *pevent; | ||
1172 | unsigned long sec, usec; | 1166 | unsigned long sec, usec; |
1173 | struct trace_seq s; | 1167 | struct trace_seq s; |
1174 | gboolean neg; | 1168 | gboolean neg; |
@@ -1187,8 +1181,6 @@ static void draw_latency(struct graph_info *ginfo, gint x, gint y) | |||
1187 | 1181 | ||
1188 | convert_nano(time, &sec, &usec); | 1182 | convert_nano(time, &sec, &usec); |
1189 | 1183 | ||
1190 | pevent = ginfo->pevent; | ||
1191 | |||
1192 | trace_seq_init(&s); | 1184 | trace_seq_init(&s); |
1193 | trace_seq_printf(&s, "Diff: %s%ld.%06lu secs", neg ? "-":"", sec, usec); | 1185 | trace_seq_printf(&s, "Diff: %s%ld.%06lu secs", neg ? "-":"", sec, usec); |
1194 | 1186 | ||
@@ -1860,7 +1852,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1860 | } | 1852 | } |
1861 | 1853 | ||
1862 | /* | 1854 | /* |
1863 | * TODO: this method needs refactoring | 1855 | * TODO: this method needs refactoring and splitting |
1864 | */ | 1856 | */ |
1865 | static void draw_hashed_plots(struct graph_info *ginfo) | 1857 | static void draw_hashed_plots(struct graph_info *ginfo) |
1866 | { | 1858 | { |
@@ -1868,8 +1860,8 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1868 | struct record *record; | 1860 | struct record *record; |
1869 | struct plot_hash *hash; | 1861 | struct plot_hash *hash; |
1870 | struct plot_list *list; | 1862 | struct plot_list *list; |
1871 | unsigned long long old_start, max_time, min_time; | 1863 | unsigned long long max_time, min_time; |
1872 | gdouble duration, start; | 1864 | gdouble start, duration; |
1873 | 1865 | ||
1874 | start = ginfo->rtg_info.start_offset; | 1866 | start = ginfo->rtg_info.start_offset; |
1875 | duration = ginfo->rtg_info.duration; | 1867 | duration = ginfo->rtg_info.duration; |
@@ -1877,11 +1869,26 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1877 | 1869 | ||
1878 | set_cpus_to_rts(ginfo, ginfo->view_start_time); | 1870 | set_cpus_to_rts(ginfo, ginfo->view_start_time); |
1879 | 1871 | ||
1880 | max_time = ginfo->view_end_time; | ||
1881 | min_time = ginfo->view_start_time; | 1872 | min_time = ginfo->view_start_time; |
1873 | max_time = ginfo->view_end_time; | ||
1874 | if (ginfo->rtg_info.start_time && duration) { | ||
1875 | max_time = MIN(max_time, min_time + duration * NSECS_PER_SEC); | ||
1876 | } | ||
1882 | 1877 | ||
1883 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1878 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
1884 | int first = ginfo->rtg_info.start_time == 0; | 1879 | unsigned long long dull, rel; |
1880 | char *dchar; | ||
1881 | int dint; | ||
1882 | /* These methods add to the lists of tasks / containers | ||
1883 | * in the system whenever a new param record is found. | ||
1884 | * Skipping these records would be very bad, so parse | ||
1885 | * them always | ||
1886 | */ | ||
1887 | #define ARG ginfo,record, &pid | ||
1888 | rt_graph_check_task_param(ARG, &dull, &dull); | ||
1889 | rt_graph_check_container_param(ARG, &dchar); | ||
1890 | rt_graph_check_server_param(ARG, &dint, &dull, &dull); | ||
1891 | #undef ARG | ||
1885 | 1892 | ||
1886 | if (get_rts(ginfo, record) < min_time) { | 1893 | if (get_rts(ginfo, record) < min_time) { |
1887 | free_record(record); | 1894 | free_record(record); |
@@ -1892,46 +1899,36 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1892 | 1899 | ||
1893 | if (get_rts(ginfo, record) > max_time) { | 1900 | if (get_rts(ginfo, record) > max_time) { |
1894 | free_record(record); | 1901 | free_record(record); |
1895 | dprintf(3, "%llu > %llu, breaking\n", | 1902 | dprintf(3, "%llu > %llu, returning\n", |
1896 | get_rts(ginfo, record), min_time); | 1903 | get_rts(ginfo, record), min_time); |
1897 | break; | 1904 | return; |
1898 | } | 1905 | } |
1899 | 1906 | ||
1900 | // TODO: hack to clean up until first release, make unhacky | 1907 | if (clean && (ginfo->rtg_info.start_time == 0 || |
1901 | if (ginfo->rtg_info.clean_records && | 1908 | get_rts(ginfo, record) < ginfo->rtg_info.start_time)) { |
1902 | (ginfo->rtg_info.start_time == 0 || get_rts(ginfo, record) < ginfo->rtg_info.start_time)) { | 1909 | |
1903 | unsigned long long dull, rel; | ||
1904 | char *dchar; | ||
1905 | int dint; | ||
1906 | |||
1907 | // These methods add to the lists of tasks / containers | ||
1908 | // in the system whenever a new param record is found. | ||
1909 | // Skipping these records would be very bad, so parse | ||
1910 | // them here if we are cleaning. Otherwise, draw_plot | ||
1911 | // will take care of this | ||
1912 | #define ARG ginfo,record, &pid | ||
1913 | rt_graph_check_task_param(ARG, &dull, &dull); | ||
1914 | rt_graph_check_container_param(ARG, &dchar); | ||
1915 | rt_graph_check_server_param(ARG, &dint, &dull, &dull); | ||
1916 | #undef ARG | ||
1917 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { | 1910 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { |
1918 | min_time = rel; | 1911 | min_time = rel + start * NSECS_PER_SEC; |
1919 | ginfo->rtg_info.start_time = min_time; | 1912 | ginfo->rtg_info.start_time = min_time; |
1920 | ginfo->view_start_time = min_time; | 1913 | ginfo->view_start_time = min_time; |
1921 | ginfo->start_time = min_time; | 1914 | ginfo->start_time = min_time; |
1922 | 1915 | ||
1923 | dprintf(3, "found release at %llu, min_time now %llu \n", | 1916 | dprintf(3, "found release at %llu, min_time: %llu\n", |
1924 | rel, min_time); | 1917 | rel, min_time); |
1925 | 1918 | ||
1926 | if (ginfo->rtg_info.duration) { | 1919 | if (ginfo->rtg_info.duration) { |
1927 | max_time = MIN(max_time, min_time + ginfo->rtg_info.duration * NSECS_PER_SEC); | 1920 | /* This will force a resize of the |
1928 | ginfo->view_end_time = max_time; | 1921 | * viewing window during the next pass |
1929 | ginfo->end_time = max_time; | 1922 | */ |
1930 | } | 1923 | ginfo->view_end_time = MIN(max_time, |
1931 | if (first) { | 1924 | min_time + duration * NSECS_PER_SEC); |
1932 | free_record(record); | ||
1933 | return; | ||
1934 | } | 1925 | } |
1926 | |||
1927 | /* Continue reading up to the minimum time to | ||
1928 | * grab any task / container param records which | ||
1929 | * have yet to be read | ||
1930 | */ | ||
1931 | max_time = MAX(min_time,get_rts(ginfo, record)); | ||
1935 | } | 1932 | } |
1936 | 1933 | ||
1937 | free_record(record); | 1934 | free_record(record); |
@@ -1957,11 +1954,12 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1957 | } | 1954 | } |
1958 | } | 1955 | } |
1959 | for (list = ginfo->all_recs; list; list = list->next) { | 1956 | for (list = ginfo->all_recs; list; list = list->next) { |
1960 | // TODO: hacky assumption that everything else can be | 1957 | /* TODO: hacky assumption that everything else can be |
1961 | // reached via previous hashes | 1958 | * reached via previous hashes |
1962 | // Should be an additional hashed list where things are | 1959 | * Should be an additional hashed list where things are |
1963 | // added with arbitrary numbers, and a pevent_other_id | 1960 | * added with arbitrary numbers, and a pevent_other_id |
1964 | // which uses id ranges x < . < y to parse cids or lids | 1961 | * which uses id ranges x < . < y to parse cids or lids |
1962 | */ | ||
1965 | if (list->plot->type == PLOT_TYPE_SERVER_TASK || | 1963 | if (list->plot->type == PLOT_TYPE_SERVER_TASK || |
1966 | list->plot->type == PLOT_TYPE_SERVER_CPU) { | 1964 | list->plot->type == PLOT_TYPE_SERVER_CPU) { |
1967 | draw_plot(ginfo, list->plot, record); | 1965 | draw_plot(ginfo, list->plot, record); |
@@ -1974,11 +1972,7 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
1974 | 1972 | ||
1975 | static void draw_plots(struct graph_info *ginfo, gint new_width) | 1973 | static void draw_plots(struct graph_info *ginfo, gint new_width) |
1976 | { | 1974 | { |
1977 | struct plot_list *list; | ||
1978 | struct graph_plot *plot; | 1975 | struct graph_plot *plot; |
1979 | struct record *record; | ||
1980 | struct plot_hash *hash; | ||
1981 | gint cpu; | ||
1982 | gint i; | 1976 | gint i; |
1983 | 1977 | ||
1984 | /* Initialize plots */ | 1978 | /* Initialize plots */ |