< prev index next >

src/share/vm/jfr/support/jfrFlush.cpp

Print this page
rev 9059 : 8224172: assert(jfr_is_event_enabled(id)) failed: invariant
Reviewed-by: dcubed, dholmes


  45 };
  46 
  47 template <typename T>
  48 class LessThanSize : AllStatic {
  49  public:
  50   static bool evaluate(T* t, size_t size) {
  51     assert(t != NULL, "invariant");
  52     return t->free_size() < size;
  53   }
  54 };
  55 
  56 bool jfr_is_event_enabled(JfrEventId id) {
  57   return JfrEventSetting::is_enabled(id);
  58 }
  59 
  60 bool jfr_has_stacktrace_enabled(JfrEventId id) {
  61   return JfrEventSetting::has_stacktrace(id);
  62 }
  63 
  64 void jfr_conditional_flush(JfrEventId id, size_t size, Thread* t) {
  65   assert(jfr_is_event_enabled(id), "invariant");
  66   if (t->jfr_thread_local()->has_native_buffer()) {
  67     JfrStorage::Buffer* const buffer = t->jfr_thread_local()->native_buffer();
  68     if (LessThanSize<JfrStorage::Buffer>::evaluate(buffer, size)) {
  69       JfrFlush f(buffer, 0, 0, t);
  70     }
  71   }
  72 }
  73 
  74 bool jfr_save_stacktrace(Thread* t) {
  75   JfrThreadLocal* const tl = t->jfr_thread_local();
  76   if (tl->has_cached_stack_trace()) {
  77     return false; // no ownership
  78   }
  79   tl->set_cached_stack_trace_id(JfrStackTraceRepository::record(t));
  80   return true;
  81 }
  82 
  83 void jfr_clear_stacktrace(Thread* t) {
  84   t->jfr_thread_local()->clear_cached_stack_trace();
  85 }


  45 };
  46 
  47 template <typename T>
  48 class LessThanSize : AllStatic {
  49  public:
  50   static bool evaluate(T* t, size_t size) {
  51     assert(t != NULL, "invariant");
  52     return t->free_size() < size;
  53   }
  54 };
  55 
  56 bool jfr_is_event_enabled(JfrEventId id) {
  57   return JfrEventSetting::is_enabled(id);
  58 }
  59 
  60 bool jfr_has_stacktrace_enabled(JfrEventId id) {
  61   return JfrEventSetting::has_stacktrace(id);
  62 }
  63 
  64 void jfr_conditional_flush(JfrEventId id, size_t size, Thread* t) {

  65   if (t->jfr_thread_local()->has_native_buffer()) {
  66     JfrStorage::Buffer* const buffer = t->jfr_thread_local()->native_buffer();
  67     if (LessThanSize<JfrStorage::Buffer>::evaluate(buffer, size)) {
  68       JfrFlush f(buffer, 0, 0, t);
  69     }
  70   }
  71 }
  72 
  73 bool jfr_save_stacktrace(Thread* t) {
  74   JfrThreadLocal* const tl = t->jfr_thread_local();
  75   if (tl->has_cached_stack_trace()) {
  76     return false; // no ownership
  77   }
  78   tl->set_cached_stack_trace_id(JfrStackTraceRepository::record(t));
  79   return true;
  80 }
  81 
  82 void jfr_clear_stacktrace(Thread* t) {
  83   t->jfr_thread_local()->clear_cached_stack_trace();
  84 }
< prev index next >