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

Method recordUserEvent

src/flightRecorder.cpp:1112–1128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110 }
1111
1112 void recordUserEvent(Buffer* buf, int tid, UserEvent* event) {
1113 // estimate of size of non-string fields of this event
1114 const size_t event_non_string_size_limit = 64;
1115 // When calling recordUserEvent, the buffer can be up to RECORDING_BUFFER_LIMIT bytes full.
1116 // Check that the buffer is not exceeded.
1117 static_assert(RECORDING_BUFFER_LIMIT + event_non_string_size_limit + ASPROF_MAX_JFR_EVENT_LENGTH
1118 <= RECORDING_BUFFER_SIZE, "output must fit within recording buffer");
1119
1120 int start = buf->skip(5);
1121 buf->put8(T_USER_EVENT);
1122 buf->putVar64(event->_start_time);
1123 buf->putVar32(tid);
1124 buf->putVar32(event->_type);
1125 buf->putByteString((const char*)event->_data,
1126 event->_len > ASPROF_MAX_JFR_EVENT_LENGTH ? ASPROF_MAX_JFR_EVENT_LENGTH : event->_len);
1127 buf->putVar32(start, buf->offset() - start);
1128 }
1129
1130 void recordProcessSample(Buffer* buf, const ProcessInfo* info) {
1131 int start = buf->skip(5);

Callers 1

recordEventMethod · 0.80

Calls 6

skipMethod · 0.80
putVar64Method · 0.80
putVar32Method · 0.80
putByteStringMethod · 0.80
put8Method · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected