src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
branchJEP-349-branch
changeset 58567 e77a97d0edbb
parent 58187 8994744e221c
child 58578 7b89c53db169
equal deleted inserted replaced
58540:43229acd75ea 58567:e77a97d0edbb
   645 }
   645 }
   646 
   646 
   647 static bool write_metadata_in_flushpoint = false;
   647 static bool write_metadata_in_flushpoint = false;
   648 
   648 
   649 size_t JfrRecorderService::flush() {
   649 size_t JfrRecorderService::flush() {
   650   size_t total_elements = 0;
   650   size_t total_elements = flush_metadata(_chunkwriter);
   651   if (write_metadata_in_flushpoint) {
       
   652     total_elements = flush_metadata(_chunkwriter);
       
   653   }
       
   654   const size_t storage_elements = flush_storage(_storage, _chunkwriter);
   651   const size_t storage_elements = flush_storage(_storage, _chunkwriter);
   655   if (0 == storage_elements) {
   652   if (0 == storage_elements) {
   656     return total_elements;
   653     return total_elements;
   657   }
   654   }
   658   total_elements += storage_elements;
   655   total_elements += storage_elements;
   672 }
   669 }
   673 
   670 
   674 typedef Content<EventFlush, JfrRecorderService, &JfrRecorderService::flush> FlushFunctor;
   671 typedef Content<EventFlush, JfrRecorderService, &JfrRecorderService::flush> FlushFunctor;
   675 typedef WriteContent<FlushFunctor> Flush;
   672 typedef WriteContent<FlushFunctor> Flush;
   676 
   673 
   677 void JfrRecorderService::flush(int msgs) {
   674 void JfrRecorderService::flushpoint() {
   678   assert(_chunkwriter.is_valid(), "invariant");
   675   assert(_chunkwriter.is_valid(), "invariant");
   679   ResourceMark rm;
   676   ResourceMark rm;
   680   HandleMark hm;
   677   HandleMark hm;
   681   write_metadata_in_flushpoint = (msgs & MSGBIT(MSG_FLUSHPOINT_METADATA));
       
   682   ++flushpoint_id;
   678   ++flushpoint_id;
   683   reset_thread_local_buffer();
   679   reset_thread_local_buffer();
   684   FlushFunctor flushpoint(*this);
   680   FlushFunctor flushpoint(*this);
   685   Flush fl(_chunkwriter, flushpoint);
   681   Flush fl(_chunkwriter, flushpoint);
   686   invoke_with_flush_event(fl);
   682   invoke_with_flush_event(fl);