summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'driver/gator_marshaling.c')
-rw-r--r--driver/gator_marshaling.c101
1 files changed, 61 insertions, 40 deletions
diff --git a/driver/gator_marshaling.c b/driver/gator_marshaling.c
index 97b4ae6..18c890d 100644
--- a/driver/gator_marshaling.c
+++ b/driver/gator_marshaling.c
@@ -231,28 +231,77 @@ static void marshal_event_single(int core, int key, int value)
231 // Check and commit; commit is set to occur once buffer is 3/4 full 231 // Check and commit; commit is set to occur once buffer is 3/4 full
232 buffer_check(cpu, COUNTER_BUF, time); 232 buffer_check(cpu, COUNTER_BUF, time);
233} 233}
234#endif
234 235
235static void marshal_event_single64(int core, int key, long long value) 236#if defined(MALI_SUPPORT)
237static void marshal_sched_gpu_start(int unit, int core, int tgid, int pid)
236{ 238{
237 unsigned long flags, cpu; 239 unsigned long cpu = get_physical_cpu(), flags;
238 u64 time; 240 u64 time;
239 241
242 if (!per_cpu(gator_buffer, cpu)[GPU_TRACE_BUF])
243 return;
244
240 local_irq_save(flags); 245 local_irq_save(flags);
241 cpu = get_physical_cpu();
242 time = gator_get_time(); 246 time = gator_get_time();
243 if (buffer_check_space(cpu, COUNTER_BUF, 2 * MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) { 247 if (buffer_check_space(cpu, GPU_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
244 gator_buffer_write_packed_int64(cpu, COUNTER_BUF, time); 248 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, MESSAGE_GPU_START);
245 gator_buffer_write_packed_int(cpu, COUNTER_BUF, core); 249 gator_buffer_write_packed_int64(cpu, GPU_TRACE_BUF, time);
246 gator_buffer_write_packed_int(cpu, COUNTER_BUF, key); 250 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, unit);
247 gator_buffer_write_packed_int64(cpu, COUNTER_BUF, value); 251 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, core);
252 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, tgid);
253 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, pid);
248 } 254 }
249 local_irq_restore(flags); 255 local_irq_restore(flags);
250 // Check and commit; commit is set to occur once buffer is 3/4 full 256 // Check and commit; commit is set to occur once buffer is 3/4 full
251 buffer_check(cpu, COUNTER_BUF, time); 257 buffer_check(cpu, GPU_TRACE_BUF, time);
258}
259
260static void marshal_sched_gpu_stop(int unit, int core)
261{
262 unsigned long cpu = get_physical_cpu(), flags;
263 u64 time;
264
265 if (!per_cpu(gator_buffer, cpu)[GPU_TRACE_BUF])
266 return;
267
268 local_irq_save(flags);
269 time = gator_get_time();
270 if (buffer_check_space(cpu, GPU_TRACE_BUF, MAXSIZE_PACK64 + 3 * MAXSIZE_PACK32)) {
271 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, MESSAGE_GPU_STOP);
272 gator_buffer_write_packed_int64(cpu, GPU_TRACE_BUF, time);
273 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, unit);
274 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, core);
275 }
276 local_irq_restore(flags);
277 // Check and commit; commit is set to occur once buffer is 3/4 full
278 buffer_check(cpu, GPU_TRACE_BUF, time);
252} 279}
253#endif 280#endif
254 281
255static void marshal_sched_trace_switch(int pid, int state) 282static void marshal_sched_trace_start(int tgid, int pid, int cookie)
283{
284 unsigned long cpu = get_physical_cpu(), flags;
285 u64 time;
286
287 if (!per_cpu(gator_buffer, cpu)[SCHED_TRACE_BUF])
288 return;
289
290 local_irq_save(flags);
291 time = gator_get_time();
292 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
293 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_START);
294 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time);
295 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, tgid);
296 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid);
297 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, cookie);
298 }
299 local_irq_restore(flags);
300 // Check and commit; commit is set to occur once buffer is 3/4 full
301 buffer_check(cpu, SCHED_TRACE_BUF, time);
302}
303
304static void marshal_sched_trace_switch(int tgid, int pid, int cookie, int state)
256{ 305{
257 unsigned long cpu = get_physical_cpu(), flags; 306 unsigned long cpu = get_physical_cpu(), flags;
258 u64 time; 307 u64 time;
@@ -265,7 +314,9 @@ static void marshal_sched_trace_switch(int pid, int state)
265 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) { 314 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
266 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_SWITCH); 315 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_SWITCH);
267 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time); 316 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time);
317 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, tgid);
268 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid); 318 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid);
319 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, cookie);
269 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, state); 320 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, state);
270 } 321 }
271 local_irq_restore(flags); 322 local_irq_restore(flags);
@@ -330,33 +381,3 @@ static void marshal_core_name(const int core, const int cpuid, const char *name)
330 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time()); 381 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time());
331} 382}
332#endif 383#endif
333
334static void marshal_activity_switch(int core, int key, int activity, int pid, int state)
335{
336 unsigned long cpu = get_physical_cpu(), flags;
337 u64 time;
338
339 if (!per_cpu(gator_buffer, cpu)[ACTIVITY_BUF])
340 return;
341
342 local_irq_save(flags);
343 time = gator_get_time();
344 if (buffer_check_space(cpu, ACTIVITY_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
345 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, MESSAGE_SWITCH);
346 gator_buffer_write_packed_int64(cpu, ACTIVITY_BUF, time);
347 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, core);
348 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, key);
349 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, activity);
350 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, pid);
351 gator_buffer_write_packed_int(cpu, ACTIVITY_BUF, state);
352 }
353 local_irq_restore(flags);
354 // Check and commit; commit is set to occur once buffer is 3/4 full
355 buffer_check(cpu, ACTIVITY_BUF, time);
356}
357
358void gator_marshal_activity_switch(int core, int key, int activity, int pid)
359{
360 // state is reserved for cpu use only
361 marshal_activity_switch(core, key, activity, pid, 0);
362}