MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / recordLog

Method recordLog

src/flightRecorder.cpp:1474–1493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1472}
1473
1474void FlightRecorder::recordLog(LogLevel level, const char* message, size_t len) {
1475 if (!_rec_lock.tryLockShared()) {
1476 // No active recording
1477 return;
1478 }
1479
1480 if (len > MAX_STRING_LENGTH) len = MAX_STRING_LENGTH;
1481 Buffer* buf = (Buffer*)alloca(len + 40);
1482 buf->reset();
1483
1484 int start = buf->skip(5);
1485 buf->put8(T_LOG);
1486 buf->putVar64(TSC::ticks());
1487 buf->put8(level);
1488 buf->putUtf8(message, len);
1489 buf->putVar32(start, buf->offset() - start);
1490 _rec->flush(buf);
1491
1492 _rec_lock.unlockShared();
1493}
1494
1495bool FlightRecorder::isJfrStarting() {
1496 return loadAcquire(_jfr_starting);

Callers 1

writeLogMethod · 0.80

Calls 10

tryLockSharedMethod · 0.80
skipMethod · 0.80
putVar64Method · 0.80
putUtf8Method · 0.80
putVar32Method · 0.80
unlockSharedMethod · 0.80
resetMethod · 0.45
put8Method · 0.45
offsetMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected