252 |
252 |
253 static juint number_of_types(const u1* data) { |
253 static juint number_of_types(const u1* data) { |
254 return read_data<juint>(data + types_offset); |
254 return read_data<juint>(data + types_offset); |
255 } |
255 } |
256 |
256 |
257 static void write_checkpoint_header(JfrChunkWriter& cw, int64_t offset_prev_cp_event, const u1* data) { |
257 static void write_checkpoint_header(JfrChunkWriter& cw, int64_t delta_to_last_checkpoint, const u1* data) { |
258 cw.reserve(sizeof(u4)); |
258 cw.reserve(sizeof(u4)); |
259 cw.write<u8>(EVENT_CHECKPOINT); |
259 cw.write<u8>(EVENT_CHECKPOINT); |
260 cw.write(starttime(data)); |
260 cw.write(starttime(data)); |
261 cw.write(duration(data)); |
261 cw.write(duration(data)); |
262 cw.write(offset_prev_cp_event); |
262 cw.write(delta_to_last_checkpoint); |
263 cw.write(checkpoint_type(data)); |
263 cw.write(checkpoint_type(data)); |
264 cw.write(number_of_types(data)); |
264 cw.write(number_of_types(data)); |
265 } |
265 } |
266 |
266 |
267 static void write_checkpoint_content(JfrChunkWriter& cw, const u1* data, size_t size) { |
267 static void write_checkpoint_content(JfrChunkWriter& cw, const u1* data, size_t size) { |
271 |
271 |
272 static size_t write_checkpoint_event(JfrChunkWriter& cw, const u1* data) { |
272 static size_t write_checkpoint_event(JfrChunkWriter& cw, const u1* data) { |
273 assert(data != NULL, "invariant"); |
273 assert(data != NULL, "invariant"); |
274 const int64_t event_begin = cw.current_offset(); |
274 const int64_t event_begin = cw.current_offset(); |
275 const int64_t last_checkpoint_event = cw.last_checkpoint_offset(); |
275 const int64_t last_checkpoint_event = cw.last_checkpoint_offset(); |
276 const int64_t delta = last_checkpoint_event == 0 ? 0 : last_checkpoint_event - event_begin; |
276 const int64_t delta_to_last_checkpoint = last_checkpoint_event == 0 ? 0 : last_checkpoint_event - event_begin; |
277 const int64_t checkpoint_size = total_size(data); |
277 const int64_t checkpoint_size = total_size(data); |
278 write_checkpoint_header(cw, delta, data); |
278 write_checkpoint_header(cw, delta_to_last_checkpoint, data); |
279 write_checkpoint_content(cw, data, checkpoint_size); |
279 write_checkpoint_content(cw, data, checkpoint_size); |
280 const int64_t event_size = cw.current_offset() - event_begin; |
280 const int64_t event_size = cw.current_offset() - event_begin; |
281 cw.write_padded_at_offset<u4>(event_size, event_begin); |
281 cw.write_padded_at_offset<u4>(event_size, event_begin); |
282 cw.set_last_checkpoint_offset(event_begin); |
282 cw.set_last_checkpoint_offset(event_begin); |
283 return (size_t)checkpoint_size; |
283 return (size_t)checkpoint_size; |
438 assert_locked_or_safepoint(ClassLoaderDataGraph_lock); |
438 assert_locked_or_safepoint(ClassLoaderDataGraph_lock); |
439 JfrTypeManager::write_type_set_for_unloaded_classes(); |
439 JfrTypeManager::write_type_set_for_unloaded_classes(); |
440 } |
440 } |
441 |
441 |
442 bool JfrCheckpointManager::is_type_set_required() { |
442 bool JfrCheckpointManager::is_type_set_required() { |
443 return JfrTraceIdEpoch::is_klass_tagged_in_epoch(); |
443 return JfrTraceIdEpoch::has_changed_tag_state(); |
444 } |
444 } |
445 |
445 |
446 bool JfrCheckpointManager::is_constant_set_required() { |
446 bool JfrCheckpointManager::is_constant_set_required() { |
447 return JfrTypeManager::is_new_constant_registered(); |
447 return JfrTypeManager::is_new_constant_registered(); |
448 } |
448 } |
455 |
455 |
456 void JfrCheckpointManager::flush_constant_set() { |
456 void JfrCheckpointManager::flush_constant_set() { |
457 flush(); |
457 flush(); |
458 } |
458 } |
459 |
459 |
460 void JfrCheckpointManager::create_thread_checkpoint(Thread* t) { |
460 void JfrCheckpointManager::create_thread_blob(Thread* t) { |
461 JfrTypeManager::create_thread_checkpoint(t); |
461 JfrTypeManager::create_thread_blob(t); |
462 } |
462 } |
463 |
463 |
464 void JfrCheckpointManager::write_thread_checkpoint(Thread* t) { |
464 void JfrCheckpointManager::write_thread_checkpoint(Thread* t) { |
465 JfrTypeManager::write_thread_checkpoint(t); |
465 JfrTypeManager::write_thread_checkpoint(t); |
466 } |
466 } |