diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-23 15:09:39 -0400 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-23 15:09:39 -0400 |
| commit | 15bbd1e788af29d06b3fb64cefd0e2e3cdd64a8b (patch) | |
| tree | 05f4fbe16f28831413082b13775650576789d261 | |
| parent | bd93158a49cd64b84d0e64735d2362dbceaecf87 (diff) | |
Add -c option to ignore records before system release.
| -rw-r--r-- | kernel-shark.c | 8 | ||||
| -rw-r--r-- | rt-graph.c | 42 | ||||
| -rw-r--r-- | rt-graph.h | 9 | ||||
| -rw-r--r-- | trace-graph.c | 69 |
4 files changed, 91 insertions, 37 deletions
diff --git a/kernel-shark.c b/kernel-shark.c index 924bcc8..d921040 100644 --- a/kernel-shark.c +++ b/kernel-shark.c | |||
| @@ -65,6 +65,7 @@ void usage(char *prog) | |||
| 65 | printf(" -h Display this help message\n"); | 65 | printf(" -h Display this help message\n"); |
| 66 | printf(" -v Display version and exit\n"); | 66 | printf(" -v Display version and exit\n"); |
| 67 | printf(" -i input_file, default is %s\n", default_input_file); | 67 | printf(" -i input_file, default is %s\n", default_input_file); |
| 68 | printf(" -c Ignore records before system release\n"); | ||
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | static gboolean display_warnings; | 71 | static gboolean display_warnings; |
| @@ -1826,13 +1827,15 @@ void kernel_shark(int argc, char **argv) | |||
| 1826 | GtkWidget *statusbar; | 1827 | GtkWidget *statusbar; |
| 1827 | int ret; | 1828 | int ret; |
| 1828 | int c; | 1829 | int c; |
| 1830 | int clean; | ||
| 1829 | 1831 | ||
| 1830 | g_thread_init(NULL); | 1832 | g_thread_init(NULL); |
| 1831 | gdk_threads_init(); | 1833 | gdk_threads_init(); |
| 1832 | 1834 | ||
| 1833 | gtk_init(&argc, &argv); | 1835 | gtk_init(&argc, &argv); |
| 1834 | 1836 | ||
| 1835 | while ((c = getopt(argc, argv, "hvi:")) != -1) { | 1837 | clean = 0; |
| 1838 | while ((c = getopt(argc, argv, "hcvi:")) != -1) { | ||
| 1836 | switch(c) { | 1839 | switch(c) { |
| 1837 | case 'h': | 1840 | case 'h': |
| 1838 | usage(basename(argv[0])); | 1841 | usage(basename(argv[0])); |
| @@ -1845,6 +1848,8 @@ void kernel_shark(int argc, char **argv) | |||
| 1845 | case 'i': | 1848 | case 'i': |
| 1846 | input_file = optarg; | 1849 | input_file = optarg; |
| 1847 | break; | 1850 | break; |
| 1851 | case 'c': | ||
| 1852 | clean = 1; | ||
| 1848 | default: | 1853 | default: |
| 1849 | /* assume the other options are for gtk */ | 1854 | /* assume the other options are for gtk */ |
| 1850 | break; | 1855 | break; |
| @@ -2396,6 +2401,7 @@ void kernel_shark(int argc, char **argv) | |||
| 2396 | info->graph_cbs.filter = ks_graph_filter; | 2401 | info->graph_cbs.filter = ks_graph_filter; |
| 2397 | 2402 | ||
| 2398 | info->ginfo = trace_graph_create_with_callbacks(handle, &info->graph_cbs); | 2403 | info->ginfo = trace_graph_create_with_callbacks(handle, &info->graph_cbs); |
| 2404 | info->ginfo->rtg_info.clean_records = clean; | ||
| 2399 | widget = trace_graph_get_window(info->ginfo); | 2405 | widget = trace_graph_get_window(info->ginfo); |
| 2400 | gtk_paned_add1(GTK_PANED(vpaned), widget); | 2406 | gtk_paned_add1(GTK_PANED(vpaned), widget); |
| 2401 | gtk_widget_show(widget); | 2407 | gtk_widget_show(widget); |
| @@ -523,6 +523,43 @@ int rt_graph_check_task_resume(struct graph_info *ginfo, | |||
| 523 | return ret; | 523 | return ret; |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | |||
| 527 | /** | ||
| 528 | * rt_graph_check_sys_release - check for system release record | ||
| 529 | * Return 1 and @when if the record matches | ||
| 530 | */ | ||
| 531 | int rt_graph_check_sys_release(struct graph_info *ginfo, | ||
| 532 | struct record *record, | ||
| 533 | unsigned long long *rel) | ||
| 534 | { | ||
| 535 | struct rt_graph_info *rtg_info = &ginfo->rtg_info; | ||
| 536 | struct pevent *pevent = ginfo->pevent; | ||
| 537 | struct event_format *event; | ||
| 538 | gint id; | ||
| 539 | int ret = 0; | ||
| 540 | |||
| 541 | if (rtg_info->sys_release_id < 0) { | ||
| 542 | event = pevent_find_event_by_name(pevent, "litmus", | ||
| 543 | "litmus_sys_release"); | ||
| 544 | if (!event) | ||
| 545 | goto out; | ||
| 546 | rtg_info->sys_release_id = event->id; | ||
| 547 | dprintf(2, "Found sys_release id %d\n", event->id); | ||
| 548 | STORE_FIELD(rtg_info, event, sys_release, rel); | ||
| 549 | } | ||
| 550 | |||
| 551 | id = pevent_data_type(pevent, record); | ||
| 552 | if (id == rtg_info->sys_release_id) { | ||
| 553 | LOAD_LONG(rtg_info, record, sys_release, rel, rel); | ||
| 554 | |||
| 555 | ret = 1; | ||
| 556 | dprintf(3, "Read sys_release (%d) record, rel: %llu\n", id, *rel); | ||
| 557 | } | ||
| 558 | out: | ||
| 559 | return ret; | ||
| 560 | } | ||
| 561 | |||
| 562 | |||
| 526 | /** | 563 | /** |
| 527 | * rt_graph_check_container_param - check for litmus_container_param record | 564 | * rt_graph_check_container_param - check for litmus_container_param record |
| 528 | * Return 1, @cid, and @name if the record matches | 565 | * Return 1, @cid, and @name if the record matches |
| @@ -876,6 +913,9 @@ void init_rt_event_cache(struct rt_graph_info *rtg_info) | |||
| 876 | 913 | ||
| 877 | memset(rtg_info, 0, sizeof(*rtg_info)); | 914 | memset(rtg_info, 0, sizeof(*rtg_info)); |
| 878 | 915 | ||
| 916 | rtg_info->clean_records = 0; | ||
| 917 | rtg_info->start_time = 0ULL; | ||
| 918 | |||
| 879 | rtg_info->task_param_id = -1; | 919 | rtg_info->task_param_id = -1; |
| 880 | rtg_info->switch_to_id = -1; | 920 | rtg_info->switch_to_id = -1; |
| 881 | rtg_info->switch_away_id = -1; | 921 | rtg_info->switch_away_id = -1; |
| @@ -884,7 +924,9 @@ void init_rt_event_cache(struct rt_graph_info *rtg_info) | |||
| 884 | rtg_info->task_block_id = -1; | 924 | rtg_info->task_block_id = -1; |
| 885 | rtg_info->task_resume_id = -1; | 925 | rtg_info->task_resume_id = -1; |
| 886 | 926 | ||
| 927 | rtg_info->sys_release_id = -1; | ||
| 887 | rtg_info->container_param_id = -1; | 928 | rtg_info->container_param_id = -1; |
| 929 | |||
| 888 | rtg_info->server_param_id = -1; | 930 | rtg_info->server_param_id = -1; |
| 889 | rtg_info->server_switch_to_id = -1; | 931 | rtg_info->server_switch_to_id = -1; |
| 890 | rtg_info->server_switch_away_id = -1; | 932 | rtg_info->server_switch_away_id = -1; |
| @@ -21,6 +21,9 @@ struct ts_list; | |||
| 21 | struct vcpu_list; | 21 | struct vcpu_list; |
| 22 | 22 | ||
| 23 | struct rt_graph_info { | 23 | struct rt_graph_info { |
| 24 | /* For ignoring records before system release */ | ||
| 25 | gboolean clean_records; | ||
| 26 | long long start_time; | ||
| 24 | 27 | ||
| 25 | /* List of all real-time tasks */ | 28 | /* List of all real-time tasks */ |
| 26 | struct task_list *tasks[TASK_HASH_SIZE]; | 29 | struct task_list *tasks[TASK_HASH_SIZE]; |
| @@ -62,6 +65,9 @@ struct rt_graph_info { | |||
| 62 | struct format_field *resume_pid_field; | 65 | struct format_field *resume_pid_field; |
| 63 | struct format_field *resume_lid_field; | 66 | struct format_field *resume_lid_field; |
| 64 | 67 | ||
| 68 | gint sys_release_id; | ||
| 69 | struct format_field *sys_release_rel_field; | ||
| 70 | |||
| 65 | gint container_param_id; | 71 | gint container_param_id; |
| 66 | struct format_field *cparam_cid_field; | 72 | struct format_field *cparam_cid_field; |
| 67 | struct format_field *cparam_name_field; | 73 | struct format_field *cparam_name_field; |
| @@ -102,7 +108,6 @@ struct rt_graph_info { | |||
| 102 | struct format_field *sresume_sid_field; | 108 | struct format_field *sresume_sid_field; |
| 103 | struct format_field *sresume_lid_field; | 109 | struct format_field *sresume_lid_field; |
| 104 | 110 | ||
| 105 | |||
| 106 | /* Cache of ts fields for non-litmus events */ | 111 | /* Cache of ts fields for non-litmus events */ |
| 107 | struct ts_list *events[TS_HASH_SIZE]; | 112 | struct ts_list *events[TS_HASH_SIZE]; |
| 108 | 113 | ||
| @@ -202,6 +207,8 @@ int rt_graph_check_server_block(struct graph_info *ginfo, | |||
| 202 | unsigned long long *when); | 207 | unsigned long long *when); |
| 203 | int rt_graph_check_server_resume(struct graph_info *ginfo, struct record *record, | 208 | int rt_graph_check_server_resume(struct graph_info *ginfo, struct record *record, |
| 204 | gint *pid, gint *lid, unsigned long long *when); | 209 | gint *pid, gint *lid, unsigned long long *when); |
| 210 | int rt_graph_check_sys_release(struct graph_info *ginfo, struct record *record, | ||
| 211 | unsigned long long *when); | ||
| 205 | void init_rt_event_cache(struct rt_graph_info *rtinfo); | 212 | void init_rt_event_cache(struct rt_graph_info *rtinfo); |
| 206 | 213 | ||
| 207 | unsigned long long get_rts(struct graph_info *ginfo, | 214 | unsigned long long get_rts(struct graph_info *ginfo, |
diff --git a/trace-graph.c b/trace-graph.c index c0f88c9..f9bd4af 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
| @@ -1859,30 +1859,57 @@ 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 | |||
| 1862 | static void draw_hashed_plots(struct graph_info *ginfo) | 1863 | static void draw_hashed_plots(struct graph_info *ginfo) |
| 1863 | { | 1864 | { |
| 1864 | gint cpu, pid; | 1865 | gint cpu, pid; |
| 1866 | gboolean started; | ||
| 1865 | struct record *record; | 1867 | struct record *record; |
| 1866 | struct plot_hash *hash; | 1868 | struct plot_hash *hash; |
| 1867 | struct plot_list *list; | 1869 | struct plot_list *list; |
| 1868 | 1870 | ||
| 1871 | set_cpus_to_rts(ginfo, ginfo->view_start_time); | ||
| 1869 | 1872 | ||
| 1870 | tracecmd_set_all_cpus_to_timestamp(ginfo->handle, | ||
| 1871 | ginfo->view_start_time); | ||
| 1872 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1873 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { |
| 1873 | if (record->ts < ginfo->view_start_time) { | 1874 | if (get_rts(ginfo, record) < ginfo->view_start_time) { |
| 1874 | free_record(record); | 1875 | free_record(record); |
| 1875 | continue; | 1876 | continue; |
| 1876 | } | 1877 | } |
| 1877 | if (record->ts > ginfo->view_end_time) { | 1878 | if (get_rts(ginfo, record) > ginfo->view_end_time) { |
| 1878 | free_record(record); | 1879 | free_record(record); |
| 1879 | break; | 1880 | break; |
| 1880 | } | 1881 | } |
| 1882 | |||
| 1883 | // TODO: hack to clean up until first release, make unhacky | ||
| 1884 | if (ginfo->rtg_info.clean_records && | ||
| 1885 | ginfo->rtg_info.start_time == 0) { | ||
| 1886 | unsigned long long dull, rel = 0; | ||
| 1887 | char *dchar; | ||
| 1888 | int dint; | ||
| 1889 | |||
| 1890 | // These methods add to the lists of tasks / containers | ||
| 1891 | // in the system whenever a new param record is found. | ||
| 1892 | // Skipping these records would be very bad, so parse | ||
| 1893 | // them here if we are cleaning. Otherwise, draw_plot | ||
| 1894 | // will take care of this | ||
| 1895 | #define ARG ginfo,record, &pid | ||
| 1896 | rt_graph_check_task_param(ARG, &dull, &dull); | ||
| 1897 | rt_graph_check_container_param(ARG, &dchar); | ||
| 1898 | rt_graph_check_server_param(ARG, &dint, &dull, &dull); | ||
| 1899 | #undef ARG | ||
| 1900 | if (rt_graph_check_sys_release(ginfo, record, &rel)) { | ||
| 1901 | dull = rel - .1 * (ginfo->view_end_time - rel);; | ||
| 1902 | ginfo->rtg_info.start_time = dull; | ||
| 1903 | ginfo->view_start_time = dull; | ||
| 1904 | } | ||
| 1905 | |||
| 1906 | free_record(record); | ||
| 1907 | continue; | ||
| 1908 | } | ||
| 1909 | |||
| 1881 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1910 | hash = trace_graph_plot_find_cpu(ginfo, cpu); |
| 1882 | if (hash) { | 1911 | if (hash) { |
| 1883 | for (list = hash->plots; list; list = list->next) { | 1912 | for (list = hash->plots; list; list = list->next) { |
| 1884 | /* if (list->plot->time != TIME_TYPE_FT) */ | ||
| 1885 | /* continue; */ | ||
| 1886 | draw_plot(ginfo, list->plot, record); | 1913 | draw_plot(ginfo, list->plot, record); |
| 1887 | } | 1914 | } |
| 1888 | } | 1915 | } |
| @@ -1890,14 +1917,10 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
| 1890 | hash = trace_graph_plot_find_task(ginfo, pid); | 1917 | hash = trace_graph_plot_find_task(ginfo, pid); |
| 1891 | if (hash) { | 1918 | if (hash) { |
| 1892 | for (list = hash->plots; list; list = list->next) { | 1919 | for (list = hash->plots; list; list = list->next) { |
| 1893 | /* if (list->plot->time != TIME_TYPE_FT) */ | ||
| 1894 | /* continue; */ | ||
| 1895 | draw_plot(ginfo, list->plot, record); | 1920 | draw_plot(ginfo, list->plot, record); |
| 1896 | } | 1921 | } |
| 1897 | } | 1922 | } |
| 1898 | for (list = ginfo->all_recs; list; list = list->next) { | 1923 | for (list = ginfo->all_recs; list; list = list->next) { |
| 1899 | /* if (list->plot->time != TIME_TYPE_FT) */ | ||
| 1900 | /* continue; */ | ||
| 1901 | // TODO: hacky assumption that everything else can be | 1924 | // TODO: hacky assumption that everything else can be |
| 1902 | // reached via previous hashes | 1925 | // reached via previous hashes |
| 1903 | // Should be an additional hashed list where things are | 1926 | // Should be an additional hashed list where things are |
| @@ -1912,30 +1935,6 @@ static void draw_hashed_plots(struct graph_info *ginfo) | |||
| 1912 | } | 1935 | } |
| 1913 | } | 1936 | } |
| 1914 | 1937 | ||
| 1915 | /* static void draw_rt_plots(struct graph_info *ginfo) */ | ||
| 1916 | /* { */ | ||
| 1917 | /* gint cpu; */ | ||
| 1918 | /* struct record *record; */ | ||
| 1919 | /* struct plot_list *list; */ | ||
| 1920 | |||
| 1921 | /* set_cpus_to_rts(ginfo, ginfo->view_start_time); */ | ||
| 1922 | /* while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { */ | ||
| 1923 | /* if (get_rts(ginfo, record) < ginfo->view_start_time) { */ | ||
| 1924 | /* free_record(record); */ | ||
| 1925 | /* continue; */ | ||
| 1926 | /* } */ | ||
| 1927 | /* if (get_rts(ginfo, record) > ginfo->view_end_time) { */ | ||
| 1928 | /* free_record(record); */ | ||
| 1929 | /* break; */ | ||
| 1930 | /* } */ | ||
| 1931 | /* for (list = ginfo->all_recs; list; list = list->next) { */ | ||
| 1932 | /* if (list->plot->time != TIME_TYPE_RT) */ | ||
| 1933 | /* continue; */ | ||
| 1934 | /* draw_plot(ginfo, list->plot, record); */ | ||
| 1935 | /* } */ | ||
| 1936 | /* free_record(record); */ | ||
| 1937 | /* } */ | ||
| 1938 | /* } */ | ||
| 1939 | 1938 | ||
| 1940 | static void draw_plots(struct graph_info *ginfo, gint new_width) | 1939 | static void draw_plots(struct graph_info *ginfo, gint new_width) |
| 1941 | { | 1940 | { |
| @@ -2341,7 +2340,7 @@ configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | |||
| 2341 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); | 2340 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); |
| 2342 | 2341 | ||
| 2343 | // TODO: don't do this, compare widget to figure out if we should redraw | 2342 | // TODO: don't do this, compare widget to figure out if we should redraw |
| 2344 | if (tries != 1 && tries != 2) | 2343 | if (tries != 2) |
| 2345 | redraw_pixmap_backend(ginfo); | 2344 | redraw_pixmap_backend(ginfo); |
| 2346 | ++tries; | 2345 | ++tries; |
| 2347 | 2346 | ||
