aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-08 20:56:54 -0500
committerJonathan <hermanjl@hermanjl-Aspire-5553G.(none)>2012-03-08 20:56:54 -0500
commit0afbf80728003d445305e32b3174ff149890dd77 (patch)
tree0938356830db7b2230dcc0695cb4a54caae144d1
parent11c9b6cac9c5cfb72ecaa88d6f5ab0c6cd0034ae (diff)
rt-graph: RT cpus show a thin black line when non-rt tasks run
-rw-r--r--rt-plot-cpu.c56
-rw-r--r--rt-plot-cpu.h3
-rw-r--r--trace-graph.c1
-rw-r--r--trace-graph.h4
4 files changed, 51 insertions, 13 deletions
diff --git a/rt-plot-cpu.c b/rt-plot-cpu.c
index 6884286..bc37df7 100644
--- a/rt-plot-cpu.c
+++ b/rt-plot-cpu.c
@@ -79,16 +79,17 @@ try_switch_away(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
79 record, &pid, &job, &ts); 79 record, &pid, &job, &ts);
80 if (match) { 80 if (match) {
81 update_pid(rtc_info, pid); 81 update_pid(rtc_info, pid);
82 if (rtc_info->run_time && rtc_info->run_time < ts) { 82 if (rtc_info->rt_run_time && rtc_info->rt_run_time < ts) {
83 info->box = TRUE; 83 info->box = TRUE;
84 info->bcolor = hash_pid(rtc_info->run_pid); 84 info->bcolor = hash_pid(rtc_info->run_pid);
85 info->bfill = TRUE; 85 info->bfill = TRUE;
86 info->bstart = rtc_info->run_time; 86 info->bstart = rtc_info->rt_run_time;
87 info->bend = ts; 87 info->bend = ts;
88 info->blabel = rtc_info->label; 88 info->blabel = rtc_info->label;
89 } 89 }
90 rtc_info->run_pid = 0; 90 rtc_info->run_pid = 0;
91 rtc_info->run_time = 0Ull; 91 rtc_info->rt_run_time = 0Ull;
92 rtc_info->reg_run_time = 0ULL;
92 } 93 }
93 return match; 94 return match;
94} 95}
@@ -104,7 +105,8 @@ try_switch_to(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
104 record, &pid, &job, &ts); 105 record, &pid, &job, &ts);
105 if (match) { 106 if (match) {
106 update_pid(rtc_info, pid); 107 update_pid(rtc_info, pid);
107 rtc_info->run_time = ts; 108 rtc_info->rt_run_time = ts;
109 rtc_info->reg_run_time = 0ULL;
108 } 110 }
109 return match; 111 return match;
110} 112}
@@ -125,17 +127,49 @@ try_completion(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
125 return match; 127 return match;
126} 128}
127 129
130static int
131try_sched_switch(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
132 struct record *record, struct plot_info *info)
133{
134 const char *comm;
135 int from_pid, to_pid, match;
136
137 match = trace_graph_check_sched_switch(ginfo, record, &to_pid, &comm);
138 if (match) {
139 from_pid = pevent_data_pid(ginfo->pevent, record);
140 /* Only draw if no real-time task is running */
141 if (!rtc_info->rt_run_time) {
142 if (rtc_info->reg_run_time &&
143 rtc_info->reg_run_time < get_rts(ginfo, record)) {
144 /* A non-rt task was running */
145 info->box = TRUE;
146 info->bthin = TRUE;
147 info->bcolor = 0x0;
148 /* info->blabel = rtc_info->label; */
149 info->bstart = rtc_info->reg_run_time;
150 info->bend = get_rts(ginfo, record);
151 }
152 if (to_pid)
153 rtc_info->reg_run_time = get_rts(ginfo, record);
154 else
155 rtc_info->reg_run_time = 0ULL;
156 }
157 update_pid(rtc_info, to_pid);
158 }
159 return match;
160}
161
128static void do_plot_end(struct graph_info *ginfo, struct rt_cpu_info *rtc_info, 162static void do_plot_end(struct graph_info *ginfo, struct rt_cpu_info *rtc_info,
129 struct plot_info *info) 163 struct plot_info *info)
130{ 164{
131 int pid; 165 int pid;
132 struct record *record; 166 struct record *record;
133 167
134 if (rtc_info->run_time && rtc_info->run_pid) { 168 if (rtc_info->rt_run_time && rtc_info->run_pid) {
135 info->box = TRUE; 169 info->box = TRUE;
136 info->bcolor = hash_pid(rtc_info->run_pid); 170 info->bcolor = hash_pid(rtc_info->run_pid);
137 info->bfill = TRUE; 171 info->bfill = TRUE;
138 info->bstart = rtc_info->run_time; 172 info->bstart = rtc_info->rt_run_time;
139 info->bend = ginfo->view_end_time; 173 info->bend = ginfo->view_end_time;
140 info->blabel = rtc_info->label; 174 info->blabel = rtc_info->label;
141 rtc_info->fresh = FALSE; 175 rtc_info->fresh = FALSE;
@@ -163,7 +197,7 @@ static int rt_cpu_plot_match_time(struct graph_info *ginfo,
163{ 197{
164 int ret = 0; 198 int ret = 0;
165 struct rt_cpu_info *rtc_info = plot->private; 199 struct rt_cpu_info *rtc_info = plot->private;
166 struct record = find_record(ginfo, rtc_info->cpu, time); 200 struct record *record = find_record(ginfo, rtc_info->cpu, time);
167 201
168 if (record && get_rts(ginfo, record) == time) 202 if (record && get_rts(ginfo, record) == time)
169 ret = 1; 203 ret = 1;
@@ -177,7 +211,8 @@ static void rt_cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
177{ 211{
178 struct rt_cpu_info *rtc_info = plot->private; 212 struct rt_cpu_info *rtc_info = plot->private;
179 213
180 rtc_info->run_time = time; 214 rtc_info->rt_run_time = time;
215 rtc_info->reg_run_time = time;
181 rtc_info->run_pid = 0; 216 rtc_info->run_pid = 0;
182 rtc_info->fresh = TRUE; 217 rtc_info->fresh = TRUE;
183} 218}
@@ -189,7 +224,6 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
189 unsigned long long ts; 224 unsigned long long ts;
190 struct rt_cpu_info *rtc_info = plot->private; 225 struct rt_cpu_info *rtc_info = plot->private;
191 struct rt_graph_info *rtg_info = &ginfo->rtg_info; 226 struct rt_graph_info *rtg_info = &ginfo->rtg_info;
192 const char *comm;
193 227
194 if (!record) { 228 if (!record) {
195 do_plot_end(ginfo, rtc_info, info); 229 do_plot_end(ginfo, rtc_info, info);
@@ -202,8 +236,8 @@ static int rt_cpu_plot_event(struct graph_info *ginfo, struct graph_plot *plot,
202 match = try_switch_away(ginfo, rtc_info, record, info) || 236 match = try_switch_away(ginfo, rtc_info, record, info) ||
203 try_switch_to(ginfo, rtc_info, record, info) || 237 try_switch_to(ginfo, rtc_info, record, info) ||
204 try_completion(ginfo, rtc_info, record, info) || 238 try_completion(ginfo, rtc_info, record, info) ||
205 trace_graph_check_sched_switch(ginfo, record, 239 try_sched_switch(ginfo, rtc_info, record, info);
206 &pid, &comm); 240
207 if (!match) { 241 if (!match) {
208 rt_graph_check_any(rtg_info, ginfo->pevent, record, 242 rt_graph_check_any(rtg_info, ginfo->pevent, record,
209 &pid, &eid, &ts); 243 &pid, &eid, &ts);
diff --git a/rt-plot-cpu.h b/rt-plot-cpu.h
index 320bf53..eb63167 100644
--- a/rt-plot-cpu.h
+++ b/rt-plot-cpu.h
@@ -3,8 +3,9 @@
3 3
4struct rt_cpu_info { 4struct rt_cpu_info {
5 int cpu; 5 int cpu;
6 unsigned long long run_time;
7 int run_pid; 6 int run_pid;
7 unsigned long long rt_run_time;
8 unsigned long long reg_run_time;
8 gboolean fresh; 9 gboolean fresh;
9 char *label; 10 char *label;
10}; 11};
diff --git a/trace-graph.c b/trace-graph.c
index 5c364e4..9ce0853 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1875,7 +1875,6 @@ static void draw_ft_plots(struct graph_info *ginfo)
1875 draw_plot(ginfo, list->plot, record); 1875 draw_plot(ginfo, list->plot, record);
1876 } 1876 }
1877 } 1877 }
1878 int stuff = 0;
1879 for (list = ginfo->all_recs; list; list = list->next) { 1878 for (list = ginfo->all_recs; list; list = list->next) {
1880 if (list->plot->time != TIME_TYPE_FT) 1879 if (list->plot->time != TIME_TYPE_FT)
1881 continue; 1880 continue;
diff --git a/trace-graph.h b/trace-graph.h
index 33bdde2..d3d4cba 100644
--- a/trace-graph.h
+++ b/trace-graph.h
@@ -29,6 +29,10 @@
29#include "rt-graph.h" 29#include "rt-graph.h"
30#include "trace-plot-task.h" 30#include "trace-plot-task.h"
31 31
32
33#define RED 0xff
34#define GREEN (0xff<<16)
35
32struct graph_info; 36struct graph_info;
33 37
34typedef void (graph_select_cb)(struct graph_info *ginfo, guint64 time); 38typedef void (graph_select_cb)(struct graph_info *ginfo, guint64 time);