diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-22 15:34:10 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2012-08-22 15:34:10 -0400 |
commit | bd93158a49cd64b84d0e64735d2362dbceaecf87 (patch) | |
tree | 042294c2d01331e349254c7f034402eb9b3ac140 | |
parent | 45ed020007488c4906740a10d1318c0d78c959f6 (diff) |
Draw plot once on load, distributing records via hashing.
redraw_pixmap_backend was being called 3 times. 2 of these times were
superflous calls to configure. Added a hack to ignore the second two configures.
Plot CPU reduction: 70%
Each record was being sent to every plot. Now, records are only sent to the CPU
and Task plots which hash to a calculated PID. Container plots currently aren't
covered by this.
Plot CPU reduction (after previous change): 30%
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | event-viewer.py | 0 | ||||
-rw-r--r-- | rt-plot-cpu.c | 7 | ||||
-rw-r--r-- | rt-plot-task.c | 11 | ||||
-rw-r--r-- | rt-plot-vtask.c | 4 | ||||
-rw-r--r-- | trace-graph.c | 82 |
6 files changed, 60 insertions, 48 deletions
@@ -215,8 +215,8 @@ INCLUDES = -I. $(CONFIG_INCLUDES) | |||
215 | include features.mk | 215 | include features.mk |
216 | 216 | ||
217 | # Set compile option CFLAGS if not set elsewhere | 217 | # Set compile option CFLAGS if not set elsewhere |
218 | CFLAGS ?= -g -Wall | 218 | CFLAGS ?= -g -Wall -pg |
219 | LDFLAGS ?= | 219 | LDFLAGS ?= -pg |
220 | 220 | ||
221 | ifndef NO_PTRACE | 221 | ifndef NO_PTRACE |
222 | ifneq ($(call try-cc,$(SOURCE_PTRACE),),y) | 222 | ifneq ($(call try-cc,$(SOURCE_PTRACE),),y) |
diff --git a/event-viewer.py b/event-viewer.py index 28afca2..28afca2 100755..100644 --- a/event-viewer.py +++ b/event-viewer.py | |||
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c index cfc19c3..9a609e0 100644 --- a/rt-plot-cpu.c +++ b/rt-plot-cpu.c | |||
@@ -513,8 +513,11 @@ void rt_plot_cpus_update_callback(gboolean accept, | |||
513 | if (plot->type != PLOT_TYPE_CPU) | 513 | if (plot->type != PLOT_TYPE_CPU) |
514 | continue; | 514 | continue; |
515 | rtc_info = plot->private; | 515 | rtc_info = plot->private; |
516 | if (!cpu_isset(selected_cpu_mask, rtc_info->cpu)) | 516 | if (!cpu_isset(selected_cpu_mask, rtc_info->cpu)) { |
517 | trace_graph_plot_remove(ginfo, plot); | 517 | trace_graph_plot_remove(ginfo, plot); |
518 | trace_graph_plot_remove_cpu(ginfo, plot, | ||
519 | rtc_info->cpu); | ||
520 | } | ||
518 | } | 521 | } |
519 | } | 522 | } |
520 | 523 | ||
@@ -573,6 +576,8 @@ void rt_plot_cpu_label(struct graph_info *ginfo, int cpu, char* label) | |||
573 | plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU, | 576 | plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_RT_CPU, |
574 | TIME_TYPE_RT, &rt_cpu_cb, rtc_info); | 577 | TIME_TYPE_RT, &rt_cpu_cb, rtc_info); |
575 | trace_graph_plot_add_all_recs(ginfo, plot); | 578 | trace_graph_plot_add_all_recs(ginfo, plot); |
579 | |||
580 | trace_graph_plot_add_cpu(ginfo, plot, cpu); | ||
576 | } | 581 | } |
577 | 582 | ||
578 | /** | 583 | /** |
diff --git a/rt-plot-task.c b/rt-plot-task.c index 0415ecc..77a517b 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -63,11 +63,7 @@ next_box_record(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
63 | static int update_job(struct rt_task_info *rtt_info, int job) | 63 | static int update_job(struct rt_task_info *rtt_info, int job) |
64 | { | 64 | { |
65 | rtt_info->fresh = FALSE; | 65 | rtt_info->fresh = FALSE; |
66 | if (job < rtt_info->last_job) { | 66 | if (job > rtt_info->last_job) { |
67 | printf("Inconsistent job state for %d:%d -> %d\n", | ||
68 | rtt_info->pid, rtt_info->last_job, job); | ||
69 | return 0; | ||
70 | } else if (job > rtt_info->last_job) { | ||
71 | rtt_info->last_job = job; | 67 | rtt_info->last_job = job; |
72 | snprintf(rtt_info->label, LLABEL, "%d:%d", | 68 | snprintf(rtt_info->label, LLABEL, "%d:%d", |
73 | rtt_info->pid, rtt_info->last_job); | 69 | rtt_info->pid, rtt_info->last_job); |
@@ -237,7 +233,7 @@ static int try_block(struct graph_info *ginfo, struct rt_task_info *rtt_info, | |||
237 | dprintf(3, "Block for %d on %d at %llu\n", | 233 | dprintf(3, "Block for %d on %d at %llu\n", |
238 | pid, record->cpu, ts); | 234 | pid, record->cpu, ts); |
239 | ret = 1; | 235 | ret = 1; |
240 | } | 236 | } |
241 | return ret; | 237 | return ret; |
242 | } | 238 | } |
243 | 239 | ||
@@ -585,6 +581,7 @@ void rt_plot_task_update_callback(gboolean accept, | |||
585 | } | 581 | } |
586 | /* Remove the plot */ | 582 | /* Remove the plot */ |
587 | trace_graph_plot_remove(ginfo, plot); | 583 | trace_graph_plot_remove(ginfo, plot); |
584 | trace_graph_plot_remove_task(ginfo, plot, rtt_info->pid); | ||
588 | } | 585 | } |
589 | 586 | ||
590 | /* Now add any plots that need to be added */ | 587 | /* Now add any plots that need to be added */ |
@@ -662,6 +659,8 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
662 | &rt_task_cb, rtt_info); | 659 | &rt_task_cb, rtt_info); |
663 | free(plot_label); | 660 | free(plot_label); |
664 | trace_graph_plot_add_all_recs(ginfo, plot); | 661 | trace_graph_plot_add_all_recs(ginfo, plot); |
662 | |||
663 | trace_graph_plot_add_task(ginfo, plot, pid); | ||
665 | } | 664 | } |
666 | 665 | ||
667 | void rt_plot_add_all_tasks(struct graph_info *ginfo) | 666 | void rt_plot_add_all_tasks(struct graph_info *ginfo) |
diff --git a/rt-plot-vtask.c b/rt-plot-vtask.c index 91eeb19..16bb942 100644 --- a/rt-plot-vtask.c +++ b/rt-plot-vtask.c | |||
@@ -16,10 +16,6 @@ | |||
16 | static void update_job(struct vcpu_info *info, int job) | 16 | static void update_job(struct vcpu_info *info, int job) |
17 | { | 17 | { |
18 | info->fresh = FALSE; | 18 | info->fresh = FALSE; |
19 | if (job < info->last_job) { | ||
20 | dprintf(1, "Inconsistent job state for server %d:%d -> %d\n", | ||
21 | info->sid, info->last_job, job); | ||
22 | } | ||
23 | 19 | ||
24 | if (job > info->last_job) { | 20 | if (job > info->last_job) { |
25 | info->last_job = job; | 21 | info->last_job = job; |
diff --git a/trace-graph.c b/trace-graph.c index 1ce3d47..c0f88c9 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -1859,7 +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 | static void draw_ft_plots(struct graph_info *ginfo) | 1862 | static void draw_hashed_plots(struct graph_info *ginfo) |
1863 | { | 1863 | { |
1864 | gint cpu, pid; | 1864 | gint cpu, pid; |
1865 | struct record *record; | 1865 | struct record *record; |
@@ -1881,8 +1881,8 @@ static void draw_ft_plots(struct graph_info *ginfo) | |||
1881 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1881 | hash = trace_graph_plot_find_cpu(ginfo, cpu); |
1882 | if (hash) { | 1882 | if (hash) { |
1883 | for (list = hash->plots; list; list = list->next) { | 1883 | for (list = hash->plots; list; list = list->next) { |
1884 | if (list->plot->time != TIME_TYPE_FT) | 1884 | /* if (list->plot->time != TIME_TYPE_FT) */ |
1885 | continue; | 1885 | /* continue; */ |
1886 | draw_plot(ginfo, list->plot, record); | 1886 | draw_plot(ginfo, list->plot, record); |
1887 | } | 1887 | } |
1888 | } | 1888 | } |
@@ -1890,44 +1890,52 @@ static void draw_ft_plots(struct graph_info *ginfo) | |||
1890 | hash = trace_graph_plot_find_task(ginfo, pid); | 1890 | hash = trace_graph_plot_find_task(ginfo, pid); |
1891 | if (hash) { | 1891 | if (hash) { |
1892 | for (list = hash->plots; list; list = list->next) { | 1892 | for (list = hash->plots; list; list = list->next) { |
1893 | if (list->plot->time != TIME_TYPE_FT) | 1893 | /* if (list->plot->time != TIME_TYPE_FT) */ |
1894 | continue; | 1894 | /* continue; */ |
1895 | draw_plot(ginfo, list->plot, record); | 1895 | draw_plot(ginfo, list->plot, record); |
1896 | } | 1896 | } |
1897 | } | 1897 | } |
1898 | for (list = ginfo->all_recs; list; list = list->next) { | 1898 | for (list = ginfo->all_recs; list; list = list->next) { |
1899 | if (list->plot->time != TIME_TYPE_FT) | 1899 | /* if (list->plot->time != TIME_TYPE_FT) */ |
1900 | continue; | 1900 | /* continue; */ |
1901 | draw_plot(ginfo, list->plot, record); | 1901 | // TODO: hacky assumption that everything else can be |
1902 | // reached via previous hashes | ||
1903 | // Should be an additional hashed list where things are | ||
1904 | // added with arbitrary numbers, and a pevent_other_id | ||
1905 | // which uses id ranges x < . < y to parse cids or lids | ||
1906 | if (list->plot->type == PLOT_TYPE_SERVER_TASK || | ||
1907 | list->plot->type == PLOT_TYPE_SERVER_CPU) { | ||
1908 | draw_plot(ginfo, list->plot, record); | ||
1909 | } | ||
1902 | } | 1910 | } |
1903 | free_record(record); | 1911 | free_record(record); |
1904 | } | 1912 | } |
1905 | } | 1913 | } |
1906 | 1914 | ||
1907 | static void draw_rt_plots(struct graph_info *ginfo) | 1915 | /* static void draw_rt_plots(struct graph_info *ginfo) */ |
1908 | { | 1916 | /* { */ |
1909 | gint cpu; | 1917 | /* gint cpu; */ |
1910 | struct record *record; | 1918 | /* struct record *record; */ |
1911 | struct plot_list *list; | 1919 | /* struct plot_list *list; */ |
1912 | 1920 | ||
1913 | set_cpus_to_rts(ginfo, ginfo->view_start_time); | 1921 | /* set_cpus_to_rts(ginfo, ginfo->view_start_time); */ |
1914 | while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { | 1922 | /* while ((record = tracecmd_read_next_data(ginfo->handle, &cpu))) { */ |
1915 | if (get_rts(ginfo, record) < ginfo->view_start_time) { | 1923 | /* if (get_rts(ginfo, record) < ginfo->view_start_time) { */ |
1916 | free_record(record); | 1924 | /* free_record(record); */ |
1917 | continue; | 1925 | /* continue; */ |
1918 | } | 1926 | /* } */ |
1919 | if (get_rts(ginfo, record) > ginfo->view_end_time) { | 1927 | /* if (get_rts(ginfo, record) > ginfo->view_end_time) { */ |
1920 | free_record(record); | 1928 | /* free_record(record); */ |
1921 | break; | 1929 | /* break; */ |
1922 | } | 1930 | /* } */ |
1923 | for (list = ginfo->all_recs; list; list = list->next) { | 1931 | /* for (list = ginfo->all_recs; list; list = list->next) { */ |
1924 | if (list->plot->time != TIME_TYPE_RT) | 1932 | /* if (list->plot->time != TIME_TYPE_RT) */ |
1925 | continue; | 1933 | /* continue; */ |
1926 | draw_plot(ginfo, list->plot, record); | 1934 | /* draw_plot(ginfo, list->plot, record); */ |
1927 | } | 1935 | /* } */ |
1928 | free_record(record); | 1936 | /* free_record(record); */ |
1929 | } | 1937 | /* } */ |
1930 | } | 1938 | /* } */ |
1931 | 1939 | ||
1932 | static void draw_plots(struct graph_info *ginfo, gint new_width) | 1940 | static void draw_plots(struct graph_info *ginfo, gint new_width) |
1933 | { | 1941 | { |
@@ -1984,8 +1992,7 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
1984 | goto out; | 1992 | goto out; |
1985 | } | 1993 | } |
1986 | 1994 | ||
1987 | draw_ft_plots(ginfo); | 1995 | draw_hashed_plots(ginfo); |
1988 | draw_rt_plots(ginfo); | ||
1989 | 1996 | ||
1990 | out: | 1997 | out: |
1991 | for (i = 0; i < ginfo->plots; i++) { | 1998 | for (i = 0; i < ginfo->plots; i++) { |
@@ -2324,6 +2331,8 @@ static void redraw_pixmap_backend(struct graph_info *ginfo) | |||
2324 | } | 2331 | } |
2325 | } | 2332 | } |
2326 | 2333 | ||
2334 | static int tries = 0; | ||
2335 | |||
2327 | static gboolean | 2336 | static gboolean |
2328 | configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | 2337 | configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
2329 | { | 2338 | { |
@@ -2331,7 +2340,10 @@ configure_event(GtkWidget *widget, GdkEventMotion *event, gpointer data) | |||
2331 | 2340 | ||
2332 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); | 2341 | gtk_widget_set_size_request(widget, ginfo->draw_width, ginfo->draw_height); |
2333 | 2342 | ||
2334 | redraw_pixmap_backend(ginfo); | 2343 | // TODO: don't do this, compare widget to figure out if we should redraw |
2344 | if (tries != 1 && tries != 2) | ||
2345 | redraw_pixmap_backend(ginfo); | ||
2346 | ++tries; | ||
2335 | 2347 | ||
2336 | /* debug */ | 2348 | /* debug */ |
2337 | ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj); | 2349 | ginfo->hadj_value = gtk_adjustment_get_value(ginfo->hadj); |