| 1419 | } |
| 1420 | |
| 1421 | void FlightRecorder::recordEvent(int lock_index, int tid, u32 call_trace_id, |
| 1422 | EventType event_type, Event* event) { |
| 1423 | if (_rec != NULL) { |
| 1424 | // Recording an event, increment the sample counter to allow |
| 1425 | // user code to attach metadata. |
| 1426 | ThreadLocalData::incrementSampleCounter(); |
| 1427 | |
| 1428 | Buffer* buf = _rec->buffer(lock_index); |
| 1429 | switch (event_type) { |
| 1430 | case PERF_SAMPLE: |
| 1431 | case EXECUTION_SAMPLE: |
| 1432 | case INSTRUMENTED_METHOD: |
| 1433 | _rec->recordExecutionSample(buf, tid, call_trace_id, (ExecutionEvent*)event); |
| 1434 | break; |
| 1435 | case METHOD_TRACE: |
| 1436 | _rec->recordMethodTrace(buf, tid, call_trace_id, (MethodTraceEvent*)event); |
| 1437 | break; |
| 1438 | case WALL_CLOCK_SAMPLE: |
| 1439 | _rec->recordWallClockSample(buf, tid, call_trace_id, (WallClockEvent*)event); |
| 1440 | break; |
| 1441 | case MALLOC_SAMPLE: |
| 1442 | _rec->recordMallocSample(buf, tid, call_trace_id, (MallocEvent*)event); |
| 1443 | break; |
| 1444 | case ALLOC_SAMPLE: |
| 1445 | _rec->recordAllocationInNewTLAB(buf, tid, call_trace_id, (AllocEvent*)event); |
| 1446 | break; |
| 1447 | case ALLOC_OUTSIDE_TLAB: |
| 1448 | _rec->recordAllocationOutsideTLAB(buf, tid, call_trace_id, (AllocEvent*)event); |
| 1449 | break; |
| 1450 | case LIVE_OBJECT: |
| 1451 | _rec->recordLiveObject(buf, tid, call_trace_id, (LiveObject*)event); |
| 1452 | break; |
| 1453 | case LOCK_SAMPLE: |
| 1454 | _rec->recordMonitorBlocked(buf, tid, call_trace_id, (LockEvent*)event); |
| 1455 | break; |
| 1456 | case PARK_SAMPLE: |
| 1457 | _rec->recordThreadPark(buf, tid, call_trace_id, (LockEvent*)event); |
| 1458 | break; |
| 1459 | case NATIVE_LOCK_SAMPLE: |
| 1460 | _rec->recordNativeLockSample(buf, tid, call_trace_id, (NativeLockEvent*)event); |
| 1461 | break; |
| 1462 | case PROFILING_WINDOW: |
| 1463 | _rec->recordWindow(buf, tid, (ProfilingWindow*)event); |
| 1464 | break; |
| 1465 | case USER_EVENT: |
| 1466 | _rec->recordUserEvent(buf, tid, (UserEvent*)event); |
| 1467 | break; |
| 1468 | } |
| 1469 | _rec->flushIfNeeded(buf); |
| 1470 | _rec->addThread(tid); |
| 1471 | } |
| 1472 | } |
| 1473 | |
| 1474 | void FlightRecorder::recordLog(LogLevel level, const char* message, size_t len) { |
| 1475 | if (!_rec_lock.tryLockShared()) { |
no test coverage detected