< prev index next >

src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp

Print this page

230 
231 static const size_t promotion_retry = 100;
232 
233 bool JfrStorage::flush_regular_buffer(BufferPtr buffer, Thread* thread) {
234   assert(buffer != NULL, "invariant");
235   assert(!buffer->lease(), "invariant");
236   assert(!buffer->transient(), "invariant");
237   const size_t unflushed_size = buffer->unflushed_size();
238   if (unflushed_size == 0) {
239     buffer->reinitialize();
240     assert(buffer->empty(), "invariant");
241     return true;
242   }
243 
244   if (buffer->excluded()) {
245     const bool thread_is_excluded = thread->jfr_thread_local()->is_excluded();
246     buffer->reinitialize(thread_is_excluded);
247     assert(buffer->empty(), "invariant");
248     if (!thread_is_excluded) {
249       // state change from exclusion to inclusion requires a thread checkpoint
250       JfrCheckpointManager::write_thread_checkpoint(thread);
251     }
252     return true;
253   }
254 
255   BufferPtr const promotion_buffer = acquire_promotion_buffer(unflushed_size, _global_mspace, *this, promotion_retry, thread);
256   if (promotion_buffer == NULL) {
257     write_data_loss(buffer, thread);
258     return false;
259   }
260   assert(promotion_buffer->acquired_by_self(), "invariant");
261   assert(promotion_buffer->free_size() >= unflushed_size, "invariant");
262   buffer->move(promotion_buffer, unflushed_size);
263   assert(buffer->empty(), "invariant");
264   return true;
265 }
266 
267 /*
268 * 1. If the buffer was a "lease" from the global system, release back.
269 * 2. If the buffer is transient (temporal dynamically allocated), retire and register full.
270 *

230 
231 static const size_t promotion_retry = 100;
232 
233 bool JfrStorage::flush_regular_buffer(BufferPtr buffer, Thread* thread) {
234   assert(buffer != NULL, "invariant");
235   assert(!buffer->lease(), "invariant");
236   assert(!buffer->transient(), "invariant");
237   const size_t unflushed_size = buffer->unflushed_size();
238   if (unflushed_size == 0) {
239     buffer->reinitialize();
240     assert(buffer->empty(), "invariant");
241     return true;
242   }
243 
244   if (buffer->excluded()) {
245     const bool thread_is_excluded = thread->jfr_thread_local()->is_excluded();
246     buffer->reinitialize(thread_is_excluded);
247     assert(buffer->empty(), "invariant");
248     if (!thread_is_excluded) {
249       // state change from exclusion to inclusion requires a thread checkpoint
250       JfrCheckpointManager::write_checkpoint(thread);
251     }
252     return true;
253   }
254 
255   BufferPtr const promotion_buffer = acquire_promotion_buffer(unflushed_size, _global_mspace, *this, promotion_retry, thread);
256   if (promotion_buffer == NULL) {
257     write_data_loss(buffer, thread);
258     return false;
259   }
260   assert(promotion_buffer->acquired_by_self(), "invariant");
261   assert(promotion_buffer->free_size() >= unflushed_size, "invariant");
262   buffer->move(promotion_buffer, unflushed_size);
263   assert(buffer->empty(), "invariant");
264   return true;
265 }
266 
267 /*
268 * 1. If the buffer was a "lease" from the global system, release back.
269 * 2. If the buffer is transient (temporal dynamically allocated), retire and register full.
270 *
< prev index next >