diff options
author | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 16:41:45 -0500 |
---|---|---|
committer | Jonathan <hermanjl@hermanjl-Aspire-5553G.(none)> | 2012-03-08 16:41:45 -0500 |
commit | 06d56ad1a6eebf565538b443c7a31444872442ee (patch) | |
tree | 546d5aa361d6a70d64ea46ca00aa1f689a5a8fb4 | |
parent | f63a8fd5b4c431f1e271829af0760939f226f72c (diff) |
rt-graph: time type abstracted out
-rw-r--r-- | rt-plot-task.c | 1 | ||||
-rw-r--r-- | trace-graph.c | 12 | ||||
-rw-r--r-- | trace-graph.h | 8 | ||||
-rw-r--r-- | trace-plot-cpu.c | 1 | ||||
-rw-r--r-- | trace-plot-task.c | 2 | ||||
-rw-r--r-- | trace-plot.c | 7 |
6 files changed, 24 insertions, 7 deletions
diff --git a/rt-plot-task.c b/rt-plot-task.c index 1e2cd5d..852f323 100644 --- a/rt-plot-task.c +++ b/rt-plot-task.c | |||
@@ -771,6 +771,7 @@ void rt_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
771 | "%s-%d\n(%llu.%1llu, %llu.%1llu)", | 771 | "%s-%d\n(%llu.%1llu, %llu.%1llu)", |
772 | comm, pid, wm, wn, pm, pn); | 772 | comm, pid, wm, wn, pm, pn); |
773 | plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK, | 773 | plot = trace_graph_plot_insert(ginfo, pos, plot_label, PLOT_TYPE_RT_TASK, |
774 | TIME_TYPE_RT, | ||
774 | &rt_task_cb, rtt_info); | 775 | &rt_task_cb, rtt_info); |
775 | free(plot_label); | 776 | free(plot_label); |
776 | 777 | ||
diff --git a/trace-graph.c b/trace-graph.c index de29e45..34c8268 100644 --- a/trace-graph.c +++ b/trace-graph.c | |||
@@ -1839,7 +1839,7 @@ static void draw_plot(struct graph_info *ginfo, struct graph_plot *plot, | |||
1839 | plot->p1, plot->p2, ginfo->draw_width, width_16, font); | 1839 | plot->p1, plot->p2, ginfo->draw_width, width_16, font); |
1840 | } | 1840 | } |
1841 | 1841 | ||
1842 | static void draw_nonrt_plots(struct graph_info *ginfo) | 1842 | static void draw_ft_plots(struct graph_info *ginfo) |
1843 | { | 1843 | { |
1844 | gint cpu, pid; | 1844 | gint cpu, pid; |
1845 | struct record *record; | 1845 | struct record *record; |
@@ -1860,7 +1860,7 @@ static void draw_nonrt_plots(struct graph_info *ginfo) | |||
1860 | hash = trace_graph_plot_find_cpu(ginfo, cpu); | 1860 | hash = trace_graph_plot_find_cpu(ginfo, cpu); |
1861 | if (hash) { | 1861 | if (hash) { |
1862 | for (list = hash->plots; list; list = list->next) { | 1862 | for (list = hash->plots; list; list = list->next) { |
1863 | if (list->plot->type == PLOT_TYPE_RT_TASK) | 1863 | if (list->plot->time != TIME_TYPE_FT) |
1864 | continue; | 1864 | continue; |
1865 | draw_plot(ginfo, list->plot, record); | 1865 | draw_plot(ginfo, list->plot, record); |
1866 | } | 1866 | } |
@@ -1869,13 +1869,13 @@ static void draw_nonrt_plots(struct graph_info *ginfo) | |||
1869 | hash = trace_graph_plot_find_task(ginfo, pid); | 1869 | hash = trace_graph_plot_find_task(ginfo, pid); |
1870 | if (hash) { | 1870 | if (hash) { |
1871 | for (list = hash->plots; list; list = list->next) { | 1871 | for (list = hash->plots; list; list = list->next) { |
1872 | if (list->plot->type == PLOT_TYPE_RT_TASK) | 1872 | if (list->plot->time != TIME_TYPE_FT) |
1873 | continue; | 1873 | continue; |
1874 | draw_plot(ginfo, list->plot, record); | 1874 | draw_plot(ginfo, list->plot, record); |
1875 | } | 1875 | } |
1876 | } | 1876 | } |
1877 | for (list = ginfo->all_recs; list; list = list->next) { | 1877 | for (list = ginfo->all_recs; list; list = list->next) { |
1878 | if (list->plot->type == PLOT_TYPE_RT_TASK) | 1878 | if (list->plot->time != TIME_TYPE_FT) |
1879 | continue; | 1879 | continue; |
1880 | draw_plot(ginfo, list->plot, record); | 1880 | draw_plot(ginfo, list->plot, record); |
1881 | } | 1881 | } |
@@ -1900,7 +1900,7 @@ static void draw_rt_plots(struct graph_info *ginfo) | |||
1900 | break; | 1900 | break; |
1901 | } | 1901 | } |
1902 | for (list = ginfo->all_recs; list; list = list->next) { | 1902 | for (list = ginfo->all_recs; list; list = list->next) { |
1903 | if (list->plot->type != PLOT_TYPE_RT_TASK) | 1903 | if (list->plot->time != TIME_TYPE_RT) |
1904 | continue; | 1904 | continue; |
1905 | draw_plot(ginfo, list->plot, record); | 1905 | draw_plot(ginfo, list->plot, record); |
1906 | } | 1906 | } |
@@ -1965,7 +1965,7 @@ static void draw_plots(struct graph_info *ginfo, gint new_width) | |||
1965 | goto out; | 1965 | goto out; |
1966 | } | 1966 | } |
1967 | 1967 | ||
1968 | draw_nonrt_plots(ginfo); | 1968 | draw_ft_plots(ginfo); |
1969 | draw_rt_plots(ginfo); | 1969 | draw_rt_plots(ginfo); |
1970 | 1970 | ||
1971 | out: | 1971 | out: |
diff --git a/trace-graph.h b/trace-graph.h index 5d7c247..cfa5db7 100644 --- a/trace-graph.h +++ b/trace-graph.h | |||
@@ -44,6 +44,11 @@ enum graph_plot_type { | |||
44 | PLOT_TYPE_RT_TASK, | 44 | PLOT_TYPE_RT_TASK, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | enum plot_time_type { | ||
48 | TIME_TYPE_FT, | ||
49 | TIME_TYPE_RT | ||
50 | }; | ||
51 | |||
47 | struct graph_plot; | 52 | struct graph_plot; |
48 | 53 | ||
49 | struct plot_info { | 54 | struct plot_info { |
@@ -133,6 +138,7 @@ struct plot_callbacks { | |||
133 | 138 | ||
134 | struct graph_plot { | 139 | struct graph_plot { |
135 | enum graph_plot_type type; | 140 | enum graph_plot_type type; |
141 | enum plot_time_type time; | ||
136 | int pos; | 142 | int pos; |
137 | char *label; | 143 | char *label; |
138 | const struct plot_callbacks *cb; | 144 | const struct plot_callbacks *cb; |
@@ -337,12 +343,14 @@ void trace_graph_plot_init(struct graph_info *ginfo); | |||
337 | struct graph_plot *trace_graph_plot_append(struct graph_info *ginfo, | 343 | struct graph_plot *trace_graph_plot_append(struct graph_info *ginfo, |
338 | const char *label, | 344 | const char *label, |
339 | enum graph_plot_type type, | 345 | enum graph_plot_type type, |
346 | enum plot_time_type time, | ||
340 | const struct plot_callbacks *cb, | 347 | const struct plot_callbacks *cb, |
341 | void *data); | 348 | void *data); |
342 | struct graph_plot *trace_graph_plot_insert(struct graph_info *ginfo, | 349 | struct graph_plot *trace_graph_plot_insert(struct graph_info *ginfo, |
343 | int pos, | 350 | int pos, |
344 | const char *label, | 351 | const char *label, |
345 | enum graph_plot_type type, | 352 | enum graph_plot_type type, |
353 | enum plot_time_type time, | ||
346 | const struct plot_callbacks *cb, | 354 | const struct plot_callbacks *cb, |
347 | void *data); | 355 | void *data); |
348 | void trace_graph_plot_remove(struct graph_info *ginfo, struct graph_plot *plot); | 356 | void trace_graph_plot_remove(struct graph_info *ginfo, struct graph_plot *plot); |
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c index 28baaa5..9b927e1 100644 --- a/trace-plot-cpu.c +++ b/trace-plot-cpu.c | |||
@@ -469,6 +469,7 @@ static void add_cpu_plot(struct graph_info *ginfo, gint cpu) | |||
469 | snprintf(label, 100, "CPU %d", cpu); | 469 | snprintf(label, 100, "CPU %d", cpu); |
470 | 470 | ||
471 | plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_CPU, | 471 | plot = trace_graph_plot_append(ginfo, label, PLOT_TYPE_CPU, |
472 | TIME_TYPE_FT, | ||
472 | &cpu_plot_cb, cpu_info); | 473 | &cpu_plot_cb, cpu_info); |
473 | trace_graph_plot_add_cpu(ginfo, plot, cpu); | 474 | trace_graph_plot_add_cpu(ginfo, plot, cpu); |
474 | } | 475 | } |
diff --git a/trace-plot-task.c b/trace-plot-task.c index d4b608b..803d89b 100644 --- a/trace-plot-task.c +++ b/trace-plot-task.c | |||
@@ -836,6 +836,7 @@ void graph_plot_init_tasks(struct graph_info *ginfo) | |||
836 | 836 | ||
837 | snprintf(label, 100, "TASK %d", pid); | 837 | snprintf(label, 100, "TASK %d", pid); |
838 | trace_graph_plot_insert(ginfo, 1, label, PLOT_TYPE_TASK, | 838 | trace_graph_plot_insert(ginfo, 1, label, PLOT_TYPE_TASK, |
839 | TIME_TYPE_FT, | ||
839 | &task_plot_cb, task_info); | 840 | &task_plot_cb, task_info); |
840 | } | 841 | } |
841 | 842 | ||
@@ -858,6 +859,7 @@ void graph_plot_task(struct graph_info *ginfo, int pid, int pos) | |||
858 | label = malloc_or_die(len); | 859 | label = malloc_or_die(len); |
859 | snprintf(label, len, "%s-%d", comm, pid); | 860 | snprintf(label, len, "%s-%d", comm, pid); |
860 | plot = trace_graph_plot_insert(ginfo, pos, label, PLOT_TYPE_TASK, | 861 | plot = trace_graph_plot_insert(ginfo, pos, label, PLOT_TYPE_TASK, |
862 | TIME_TYPE_RT, | ||
861 | &task_plot_cb, task_info); | 863 | &task_plot_cb, task_info); |
862 | free(label); | 864 | free(label); |
863 | 865 | ||
diff --git a/trace-plot.c b/trace-plot.c index e459969..5629e47 100644 --- a/trace-plot.c +++ b/trace-plot.c | |||
@@ -76,6 +76,7 @@ allocate_plot(struct graph_info *ginfo, | |||
76 | struct graph_plot * | 76 | struct graph_plot * |
77 | trace_graph_plot_append(struct graph_info *ginfo, | 77 | trace_graph_plot_append(struct graph_info *ginfo, |
78 | const char *label, enum graph_plot_type type, | 78 | const char *label, enum graph_plot_type type, |
79 | enum plot_time_type time, | ||
79 | const struct plot_callbacks *cb, void *data) | 80 | const struct plot_callbacks *cb, void *data) |
80 | { | 81 | { |
81 | struct graph_plot *plot; | 82 | struct graph_plot *plot; |
@@ -84,6 +85,7 @@ trace_graph_plot_append(struct graph_info *ginfo, | |||
84 | 85 | ||
85 | plot->type = type; | 86 | plot->type = type; |
86 | plot->pos = ginfo->plots; | 87 | plot->pos = ginfo->plots; |
88 | plot->time = time; | ||
87 | 89 | ||
88 | if (!ginfo->plots) { | 90 | if (!ginfo->plots) { |
89 | ginfo->plot_array = malloc_or_die(sizeof(ginfo->plot_array[0])); | 91 | ginfo->plot_array = malloc_or_die(sizeof(ginfo->plot_array[0])); |
@@ -107,13 +109,15 @@ trace_graph_plot_append(struct graph_info *ginfo, | |||
107 | struct graph_plot * | 109 | struct graph_plot * |
108 | trace_graph_plot_insert(struct graph_info *ginfo, | 110 | trace_graph_plot_insert(struct graph_info *ginfo, |
109 | int pos, const char *label, enum graph_plot_type type, | 111 | int pos, const char *label, enum graph_plot_type type, |
112 | enum plot_time_type time, | ||
110 | const struct plot_callbacks *cb, void *data) | 113 | const struct plot_callbacks *cb, void *data) |
111 | { | 114 | { |
112 | struct graph_plot *plot; | 115 | struct graph_plot *plot; |
113 | int i; | 116 | int i; |
114 | 117 | ||
115 | if (pos >= ginfo->plots) | 118 | if (pos >= ginfo->plots) |
116 | return trace_graph_plot_append(ginfo, label, type, cb, data); | 119 | return trace_graph_plot_append(ginfo, label, type, |
120 | time, cb, data); | ||
117 | 121 | ||
118 | if (pos < 0) | 122 | if (pos < 0) |
119 | pos = 0; | 123 | pos = 0; |
@@ -121,6 +125,7 @@ trace_graph_plot_insert(struct graph_info *ginfo, | |||
121 | plot = allocate_plot(ginfo, label, cb, data); | 125 | plot = allocate_plot(ginfo, label, cb, data); |
122 | plot->pos = pos; | 126 | plot->pos = pos; |
123 | plot->type = type; | 127 | plot->type = type; |
128 | plot->time = time; | ||
124 | ginfo->plot_array = realloc(ginfo->plot_array, | 129 | ginfo->plot_array = realloc(ginfo->plot_array, |
125 | sizeof(ginfo->plot_array[0]) * | 130 | sizeof(ginfo->plot_array[0]) * |
126 | (ginfo->plots + 1)); | 131 | (ginfo->plots + 1)); |