summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'driver/gator_marshaling.c')
-rw-r--r--driver/gator_marshaling.c101
1 files changed, 40 insertions, 61 deletions
diff --git a/driver/gator_marshaling.c b/driver/gator_marshaling.c
index 18c890d..97b4ae6 100644
--- a/driver/gator_marshaling.c
+++ b/driver/gator_marshaling.c
@@ -231,77 +231,28 @@ 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
235 234
236#if defined(MALI_SUPPORT) 235static void marshal_event_single64(int core, int key, long long value)
237static void marshal_sched_gpu_start(int unit, int core, int tgid, int pid)
238{ 236{
239 unsigned long cpu = get_physical_cpu(), flags; 237 unsigned long flags, cpu;
240 u64 time;
241
242 if (!per_cpu(gator_buffer, cpu)[GPU_TRACE_BUF])
243 return;
244
245 local_irq_save(flags);
246 time = gator_get_time();
247 if (buffer_check_space(cpu, GPU_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
248 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, MESSAGE_GPU_START);
249 gator_buffer_write_packed_int64(cpu, GPU_TRACE_BUF, time);
250 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, unit);
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);
254 }
255 local_irq_restore(flags);
256 // Check and commit; commit is set to occur once buffer is 3/4 full
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; 238 u64 time;
264 239
265 if (!per_cpu(gator_buffer, cpu)[GPU_TRACE_BUF])
266 return;
267
268 local_irq_save(flags); 240 local_irq_save(flags);
241 cpu = get_physical_cpu();
269 time = gator_get_time(); 242 time = gator_get_time();
270 if (buffer_check_space(cpu, GPU_TRACE_BUF, MAXSIZE_PACK64 + 3 * MAXSIZE_PACK32)) { 243 if (buffer_check_space(cpu, COUNTER_BUF, 2 * MAXSIZE_PACK64 + 2 * MAXSIZE_PACK32)) {
271 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, MESSAGE_GPU_STOP); 244 gator_buffer_write_packed_int64(cpu, COUNTER_BUF, time);
272 gator_buffer_write_packed_int64(cpu, GPU_TRACE_BUF, time); 245 gator_buffer_write_packed_int(cpu, COUNTER_BUF, core);
273 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, unit); 246 gator_buffer_write_packed_int(cpu, COUNTER_BUF, key);
274 gator_buffer_write_packed_int(cpu, GPU_TRACE_BUF, core); 247 gator_buffer_write_packed_int64(cpu, COUNTER_BUF, value);
275 } 248 }
276 local_irq_restore(flags); 249 local_irq_restore(flags);
277 // Check and commit; commit is set to occur once buffer is 3/4 full 250 // Check and commit; commit is set to occur once buffer is 3/4 full
278 buffer_check(cpu, GPU_TRACE_BUF, time); 251 buffer_check(cpu, COUNTER_BUF, time);
279} 252}
280#endif 253#endif
281 254
282static void marshal_sched_trace_start(int tgid, int pid, int cookie) 255static void marshal_sched_trace_switch(int pid, int state)
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)
305{ 256{
306 unsigned long cpu = get_physical_cpu(), flags; 257 unsigned long cpu = get_physical_cpu(), flags;
307 u64 time; 258 u64 time;
@@ -314,9 +265,7 @@ static void marshal_sched_trace_switch(int tgid, int pid, int cookie, int state)
314 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) { 265 if (buffer_check_space(cpu, SCHED_TRACE_BUF, MAXSIZE_PACK64 + 5 * MAXSIZE_PACK32)) {
315 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_SWITCH); 266 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, MESSAGE_SCHED_SWITCH);
316 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time); 267 gator_buffer_write_packed_int64(cpu, SCHED_TRACE_BUF, time);
317 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, tgid);
318 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid); 268 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, pid);
319 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, cookie);
320 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, state); 269 gator_buffer_write_packed_int(cpu, SCHED_TRACE_BUF, state);
321 } 270 }
322 local_irq_restore(flags); 271 local_irq_restore(flags);
@@ -381,3 +330,33 @@ static void marshal_core_name(const int core, const int cpuid, const char *name)
381 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time()); 330 gator_commit_buffer(cpu, SUMMARY_BUF, gator_get_time());
382} 331}
383#endif 332#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}