< prev index next >

src/hotspot/share/jfr/recorder/jfrRecorder.cpp

Print this page
@@ -30,19 +30,21 @@
  #include "jfr/leakprofiler/sampling/objectSampler.hpp"
  #include "jfr/periodic/jfrOSInterface.hpp"
  #include "jfr/periodic/sampling/jfrThreadSampler.hpp"
  #include "jfr/recorder/jfrRecorder.hpp"
  #include "jfr/recorder/checkpoint/jfrCheckpointManager.hpp"
+ #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.hpp"
  #include "jfr/recorder/repository/jfrRepository.hpp"
  #include "jfr/recorder/service/jfrEventThrottler.hpp"
  #include "jfr/recorder/service/jfrOptionSet.hpp"
  #include "jfr/recorder/service/jfrPostBox.hpp"
  #include "jfr/recorder/service/jfrRecorderService.hpp"
  #include "jfr/recorder/service/jfrRecorderThread.hpp"
  #include "jfr/recorder/storage/jfrStorage.hpp"
  #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
  #include "jfr/recorder/stringpool/jfrStringPool.hpp"
+ #include "jfr/support/jfrJavaThread.hpp"
  #include "jfr/utilities/jfrTime.hpp"
  #include "jfr/writers/jfrJavaEventWriter.hpp"
  #include "logging/log.hpp"
  #include "logging/logStream.hpp"
  #include "memory/resourceArea.inline.hpp"

@@ -194,10 +196,13 @@
  
  bool JfrRecorder::on_create_vm_2() {
    if (is_cds_dump_requested()) {
      return true;
    }
+   if (!JfrTraceId::initialize()) {
+     return false;
+   }
    JavaThread* const thread = JavaThread::current();
    if (!JfrOptionSet::initialize(thread)) {
      return false;
    }
    if (!register_jfr_dcmds()) {

@@ -291,10 +296,13 @@
      return false;
    }
    if (!create_event_throttler()) {
      return false;
    }
+   if (!create_virtual_thread_support()) {
+     return false;
+   }
    return true;
  }
  
  // subsystems
  static JfrPostBox* _post_box = NULL;

@@ -368,10 +376,16 @@
  
  bool JfrRecorder::create_event_throttler() {
    return JfrEventThrottler::create();
  }
  
+ bool JfrRecorder::create_virtual_thread_support() {
+   // bool parameter, notifyJvmti, enables jvmti events related to VirtualThreads.
+   // Thread start events hooks into some of these callbacks for JFR.
+   return JfrJavaThread::initialize(false);
+ }
+ 
  void JfrRecorder::destroy_components() {
    JfrJvmtiAgent::destroy();
    if (_post_box != NULL) {
      JfrPostBox::destroy();
      _post_box = NULL;
< prev index next >