src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp
branchJEP-349-branch
changeset 57870 00860d9caf4d
parent 57361 53dccc90a5be
child 57887 a9cc3698a55c
--- a/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp	Fri Aug 23 18:47:55 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/repository/jfrChunk.cpp	Sat Aug 24 14:30:27 2019 +0200
@@ -32,6 +32,10 @@
 #include "runtime/os.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
+static const char* const MAGIC = "FLR";
+static const u2 JFR_VERSION_MAJOR = 2;
+static const u2 JFR_VERSION_MINOR = 0;
+
 static const u1 GUARD = 0xff;
 
 static jlong nanos_now() {
@@ -66,6 +70,29 @@
   _generation = 1;
 }
 
+const char* JfrChunk::magic() const {
+  return MAGIC;
+}
+
+u2 JfrChunk::major_version() const {
+  return JFR_VERSION_MAJOR;
+}
+
+u2 JfrChunk::minor_version() const {
+  return JFR_VERSION_MINOR;
+}
+
+u2 JfrChunk::capabilities() const {
+  // chunk capabilities, CompressedIntegers etc
+  static bool compressed_integers = JfrOptionSet::compressed_integers();
+  return compressed_integers;
+}
+
+int64_t JfrChunk::cpu_frequency() const {
+  static const jlong frequency = JfrTime::frequency();
+  return frequency;
+}
+
 void JfrChunk::set_last_checkpoint_offset(int64_t offset) {
   _last_checkpoint_offset = offset;
 }
@@ -190,3 +217,8 @@
   return this_generation;
 }
 
+u1 JfrChunk::next_generation() const {
+  assert(_generation > 0, "invariant");
+  const u1 next_gen = _generation;
+  return GUARD == next_gen ? 1 : next_gen;
+}