src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp
changeset 53897 0abec72a3ac2
parent 53582 881c5fbeb849
equal deleted inserted replaced
53896:b47fd614c75e 53897:0abec72a3ac2
    27 #include "jfr/recorder/repository/jfrChunkRotation.hpp"
    27 #include "jfr/recorder/repository/jfrChunkRotation.hpp"
    28 #include "jfr/recorder/repository/jfrChunkWriter.hpp"
    28 #include "jfr/recorder/repository/jfrChunkWriter.hpp"
    29 #include "runtime/handles.inline.hpp"
    29 #include "runtime/handles.inline.hpp"
    30 
    30 
    31 static jobject chunk_monitor = NULL;
    31 static jobject chunk_monitor = NULL;
    32 static intptr_t threshold = 0;
    32 static int64_t threshold = 0;
    33 static bool rotate = false;
    33 static bool rotate = false;
    34 
    34 
    35 static jobject install_chunk_monitor(Thread* thread) {
    35 static jobject install_chunk_monitor(Thread* thread) {
    36   assert(chunk_monitor == NULL, "invariant");
    36   assert(chunk_monitor == NULL, "invariant");
    37   // read static field
    37   // read static field
    60   assert(threshold > 0, "invariant");
    60   assert(threshold > 0, "invariant");
    61   if (rotate) {
    61   if (rotate) {
    62     // already in progress
    62     // already in progress
    63     return;
    63     return;
    64   }
    64   }
    65   assert(!rotate, "invariant");
       
    66   if (writer.size_written() > threshold) {
    65   if (writer.size_written() > threshold) {
    67     rotate = true;
    66     rotate = true;
    68     notify();
    67     notify();
    69   }
    68   }
    70 }
    69 }
    75 
    74 
    76 void JfrChunkRotation::on_rotation() {
    75 void JfrChunkRotation::on_rotation() {
    77   rotate = false;
    76   rotate = false;
    78 }
    77 }
    79 
    78 
    80 void JfrChunkRotation::set_threshold(intptr_t bytes) {
    79 void JfrChunkRotation::set_threshold(int64_t bytes) {
    81   threshold = bytes;
    80   threshold = bytes;
    82 }
    81 }