| 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); |
no test coverage detected