< prev index next >

src/hotspot/share/jfr/recorder/service/jfrEvent.hpp

Print this page

203     if (!large) {
204       // Try large size
205       if (write_sized_event(buffer, event_thread, tl, true)) {
206         // Event written succesfully, use large size from now on
207         set_large();
208       }
209     }
210   }
211 
212   bool write_sized_event(JfrBuffer* const buffer, Thread* const event_thread, JfrThreadLocal* const tl, bool large_size) {
213     JfrNativeEventWriter writer(buffer, event_thread);
214     writer.begin_event_write(large_size);
215     writer.write<u8>(T::eventId);
216     assert(_start_time != 0, "invariant");
217     writer.write(_start_time);
218     if (!(T::isInstant || T::isRequestable) || T::hasCutoff) {
219       assert(_end_time != 0, "invariant");
220       writer.write(_end_time - _start_time);
221     }
222     if (T::hasThread) {
223       writer.write(tl->thread_id());
224     }
225     if (T::hasStackTrace) {
226       if (is_stacktrace_enabled()) {
227         if (tl->has_cached_stack_trace()) {
228           writer.write(tl->cached_stack_trace_id());
229         } else {
230           writer.write(JfrStackTraceRepository::record(event_thread));
231         }
232       } else {
233         writer.write<traceid>(0);
234       }
235     }
236     // payload
237     static_cast<T*>(this)->writeData(writer);
238     return writer.end_event_write(large_size) > 0;
239   }
240 
241 #ifdef ASSERT
242  private:
243   // verification of event fields

203     if (!large) {
204       // Try large size
205       if (write_sized_event(buffer, event_thread, tl, true)) {
206         // Event written succesfully, use large size from now on
207         set_large();
208       }
209     }
210   }
211 
212   bool write_sized_event(JfrBuffer* const buffer, Thread* const event_thread, JfrThreadLocal* const tl, bool large_size) {
213     JfrNativeEventWriter writer(buffer, event_thread);
214     writer.begin_event_write(large_size);
215     writer.write<u8>(T::eventId);
216     assert(_start_time != 0, "invariant");
217     writer.write(_start_time);
218     if (!(T::isInstant || T::isRequestable) || T::hasCutoff) {
219       assert(_end_time != 0, "invariant");
220       writer.write(_end_time - _start_time);
221     }
222     if (T::hasThread) {
223       writer.write(JfrThreadLocal::thread_id(event_thread));
224     }
225     if (T::hasStackTrace) {
226       if (is_stacktrace_enabled()) {
227         if (tl->has_cached_stack_trace()) {
228           writer.write(tl->cached_stack_trace_id());
229         } else {
230           writer.write(JfrStackTraceRepository::record(event_thread));
231         }
232       } else {
233         writer.write<traceid>(0);
234       }
235     }
236     // payload
237     static_cast<T*>(this)->writeData(writer);
238     return writer.end_event_write(large_size) > 0;
239   }
240 
241 #ifdef ASSERT
242  private:
243   // verification of event fields
< prev index next >