rename from JfrCheckpointMode to JfrCheckpointType JEP-349-branch
authormgronlun
Tue, 27 Aug 2019 12:08:01 +0200
branchJEP-349-branch
changeset 57886 87f8a814310d
parent 57883 90e867ac8c37
child 57887 a9cc3698a55c
rename from JfrCheckpointMode to JfrCheckpointType
src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp
src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp
src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp
src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp
src/hotspot/share/jfr/utilities/jfrTypes.hpp
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Mon Aug 26 18:10:34 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Tue Aug 27 12:08:01 2019 +0200
@@ -225,8 +225,8 @@
 // offsets into the JfrCheckpointEntry
 static const juint starttime_offset = sizeof(jlong);
 static const juint duration_offset = starttime_offset + sizeof(jlong);
-static const juint mode_offset = duration_offset + sizeof(jlong);
-static const juint types_offset = mode_offset + sizeof(juint);
+static const juint checkpoint_type_offset = duration_offset + sizeof(jlong);
+static const juint types_offset = checkpoint_type_offset + sizeof(juint);
 static const juint payload_offset = types_offset + sizeof(juint);
 
 template <typename Return>
@@ -246,8 +246,8 @@
   return read_data<jlong>(data + duration_offset);
 }
 
-static u1 mode(const u1* data) {
-  return read_data<u1>(data + mode_offset);
+static u1 checkpoint_type(const u1* data) {
+  return read_data<u1>(data + checkpoint_type_offset);
 }
 
 static juint number_of_types(const u1* data) {
@@ -260,7 +260,7 @@
   cw.write(starttime(data));
   cw.write(duration(data));
   cw.write(offset_prev_cp_event);
-  cw.write(mode(data));
+  cw.write(checkpoint_type(data));
   cw.write(number_of_types(data));
 }
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp	Mon Aug 26 18:10:34 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.cpp	Tue Aug 27 12:08:01 2019 +0200
@@ -30,12 +30,12 @@
 JfrCheckpointFlush::JfrCheckpointFlush(Type* old, size_t used, size_t requested, Thread* t) :
   _result(JfrCheckpointManager::flush(old, used, requested, t)) {}
 
-JfrCheckpointWriter::JfrCheckpointWriter(JfrCheckpointMode mode /* NORMAL */) :
+JfrCheckpointWriter::JfrCheckpointWriter(JfrCheckpointType type /* GENERIC */) :
   JfrCheckpointWriterBase(JfrCheckpointManager::lease_buffer(Thread::current()), Thread::current()),
   _time(JfrTicks::now()),
   _offset(0),
   _count(0),
-  _mode(mode),
+  _type(type),
   _header(true) {
   assert(this->is_acquired(), "invariant");
   assert(0 == this->current_offset(), "invariant");
@@ -44,12 +44,12 @@
   }
 }
 
-JfrCheckpointWriter::JfrCheckpointWriter(Thread* t, bool header /* true */, JfrCheckpointMode mode /* NORMAL */) :
+JfrCheckpointWriter::JfrCheckpointWriter(Thread* t, bool header /* true */, JfrCheckpointType type /* GENERIC */) :
   JfrCheckpointWriterBase(JfrCheckpointManager::lease_buffer(t), t),
   _time(JfrTicks::now()),
   _offset(0),
   _count(0),
-  _mode(mode),
+  _type(type),
   _header(header) {
   assert(this->is_acquired(), "invariant");
   assert(0 == this->current_offset(), "invariant");
@@ -58,12 +58,12 @@
   }
 }
 
-JfrCheckpointWriter::JfrCheckpointWriter(Thread* t, JfrBuffer* buffer, JfrCheckpointMode mode /* NORMAL */) :
+JfrCheckpointWriter::JfrCheckpointWriter(Thread* t, JfrBuffer* buffer, JfrCheckpointType type /* GENERIC */) :
   JfrCheckpointWriterBase(buffer, t),
   _time(JfrTicks::now()),
   _offset(0),
   _count(0),
-  _mode(mode),
+  _type(type),
   _header(true) {
   assert(this->is_acquired(), "invariant");
   assert(0 == this->current_offset(), "invariant");
@@ -72,13 +72,13 @@
   }
 }
 
-static void write_checkpoint_header(u1* pos, int64_t size, jlong time, u4 mode, u4 type_count) {
+static void write_checkpoint_header(u1* pos, int64_t size, jlong time, u4 checkpoint_type, u4 type_count) {
   assert(pos != NULL, "invariant");
   JfrBigEndianWriter be_writer(pos, sizeof(JfrCheckpointEntry));
   be_writer.write(size);
   be_writer.write(time);
   be_writer.write(JfrTicks::now().value() - time);
-  be_writer.write(mode);
+  be_writer.write(checkpoint_type);
   be_writer.write(type_count);
   assert(be_writer.is_valid(), "invariant");
 }
@@ -101,7 +101,7 @@
   assert(this->used_size() > sizeof(JfrCheckpointEntry), "invariant");
   const int64_t size = this->current_offset();
   assert(size + this->start_pos() == this->current_pos(), "invariant");
-  write_checkpoint_header(const_cast<u1*>(this->start_pos()), size, _time, _mode, count());
+  write_checkpoint_header(const_cast<u1*>(this->start_pos()), size, _time, _type, count());
   release();
 }
 
@@ -159,7 +159,7 @@
   }
   *size = this->used_size();
   assert(this->start_pos() + *size == this->current_pos(), "invariant");
-  write_checkpoint_header(const_cast<u1*>(this->start_pos()), this->used_offset(), _time, _mode, count());
+  write_checkpoint_header(const_cast<u1*>(this->start_pos()), this->used_offset(), _time, _type, count());
   _header = false; // the header is already written
   if (move) {
     this->seek(_offset);
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp	Mon Aug 26 18:10:34 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointWriter.hpp	Tue Aug 27 12:08:01 2019 +0200
@@ -60,7 +60,7 @@
   JfrTicks _time;
   int64_t _offset;
   u4 _count;
-  JfrCheckpointMode _mode;
+  JfrCheckpointType _type;
   bool _header;
 
   u4 count() const;
@@ -68,10 +68,10 @@
   void increment();
   const u1* session_data(size_t* size, bool move = false, const JfrCheckpointContext* ctx = NULL);
   void release();
-  JfrCheckpointWriter(Thread* t, JfrBuffer* buffer, JfrCheckpointMode mode = NORMAL);
+  JfrCheckpointWriter(Thread* t, JfrBuffer* buffer, JfrCheckpointType type = GENERIC);
  public:
-  JfrCheckpointWriter(JfrCheckpointMode mode = NORMAL);
-  JfrCheckpointWriter(Thread* t, bool header = true, JfrCheckpointMode mode = NORMAL);
+  JfrCheckpointWriter(JfrCheckpointType type = GENERIC);
+  JfrCheckpointWriter(Thread* t, bool header = true, JfrCheckpointType mode = GENERIC);
   ~JfrCheckpointWriter();
   void write_type(JfrTypeId type_id);
   void write_count(u4 nof_entries);
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp	Mon Aug 26 18:10:34 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunkWriter.cpp	Tue Aug 27 12:08:01 2019 +0200
@@ -183,14 +183,15 @@
   }
 };
 
-static void write_checkpoint_header(JfrChunkWriter& cw, int64_t event_offset, u1 mode) {
+static void write_checkpoint_header(JfrChunkWriter& cw, int64_t event_offset, bool flushpoint) {
   const int64_t delta = cw.last_checkpoint_offset() == 0 ? 0 : cw.last_checkpoint_offset() - event_offset;
+  const u1 checkpoint_type = flushpoint ? FLUSH | HEADER : HEADER;
   cw.reserve(sizeof(u4));
   cw.write<u8>(EVENT_CHECKPOINT);
   cw.write<u8>(JfrTicks::now().value());
   cw.write<u8>(0); // duration
   cw.write<u8>(delta); // to previous checkpoint
-  cw.write<u1>(mode);
+  cw.write<u1>(checkpoint_type);
   cw.write<u4>(1); // pool count
   cw.write<u8>(TYPE_CHUNKHEADER);
   cw.write<u4>(1); // count
@@ -201,8 +202,7 @@
 int64_t JfrChunkWriter::write_chunk_header_checkpoint(bool flushpoint) {
   assert(this->has_valid_fd(), "invariant");
   const int64_t event_size_offset = current_offset();
-  const u1 mode = flushpoint ? FLUSH | HEADER : HEADER;
-  write_checkpoint_header(*this, event_size_offset, mode);
+  write_checkpoint_header(*this, event_size_offset, flushpoint);
   const int64_t start_offset = current_offset();
   JfrChunkHeadWriter head(this, start_offset, false);
   head.write_magic();
--- a/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Mon Aug 26 18:10:34 2019 +0200
+++ b/src/hotspot/share/jfr/utilities/jfrTypes.hpp	Tue Aug 27 12:08:01 2019 +0200
@@ -76,8 +76,8 @@
   TIMED
 };
 
-enum JfrCheckpointMode : u1 {
-  NORMAL,
+enum JfrCheckpointType : u1 {
+  GENERIC,
   FLUSH,
   HEADER,
   STATICS = 4,