< prev index next >

src/hotspot/share/services/diagnosticCommand.cpp

Print this page
@@ -126,10 +126,11 @@
  #if INCLUDE_JVMTI
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JVMTIDataDumpDCmd>(full_export, true, false));
  #endif // INCLUDE_JVMTI
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpToFileDCmd>(full_export, true, false));
+   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VThreadSchedulerDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
    DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));

@@ -1185,11 +1186,10 @@
  
    Handle h_path = java_lang_String::create_from_str(path, CHECK);
  
    Symbol* sym = vmSymbols::jdk_internal_vm_ThreadDumper();
    Klass* k = SystemDictionary::resolve_or_fail(sym, true, CHECK);
-   InstanceKlass* ik = InstanceKlass::cast(k);
    if (HAS_PENDING_EXCEPTION) {
      java_lang_Throwable::print(PENDING_EXCEPTION, output());
      output()->cr();
      CLEAR_PENDING_EXCEPTION;
      return;

@@ -1222,10 +1222,50 @@
    typeArrayOop ba = typeArrayOop(res);
    jbyte* addr = typeArrayOop(res)->byte_at_addr(0);
    output()->print_raw((const char*)addr, ba->length());
  }
  
+ void VThreadSchedulerDCmd::execute(DCmdSource source, TRAPS) {
+   ResourceMark rm(THREAD);
+   HandleMark hm(THREAD);
+ 
+   Symbol* sym = vmSymbols::java_lang_VirtualThread();
+   Klass* k = SystemDictionary::resolve_or_fail(sym, true, CHECK);
+   if (HAS_PENDING_EXCEPTION) {
+     java_lang_Throwable::print(PENDING_EXCEPTION, output());
+     output()->cr();
+     CLEAR_PENDING_EXCEPTION;
+     return;
+   }
+ 
+   // invoke printDefaultScheduler method
+   JavaValue result(T_OBJECT);
+   JavaCallArguments args;
+   JavaCalls::call_static(&result,
+                          k,
+                          vmSymbols::printDefaultScheduler_name(),
+                          vmSymbols::void_byte_array_signature(),
+                          &args,
+                          THREAD);
+   if (HAS_PENDING_EXCEPTION) {
+     java_lang_Throwable::print(PENDING_EXCEPTION, output());
+     output()->cr();
+     CLEAR_PENDING_EXCEPTION;
+     return;
+   }
+ 
+   // check that result is byte array
+   oop res = cast_to_oop(result.get_jobject());
+   assert(res->is_typeArray(), "just checking");
+   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking");
+ 
+   // copy the bytes to the output stream
+   typeArrayOop ba = typeArrayOop(res);
+   jbyte* addr = typeArrayOop(res)->byte_at_addr(0);
+   output()->print_raw((const char*)addr, ba->length());
+ }
+ 
  CompilationMemoryStatisticDCmd::CompilationMemoryStatisticDCmd(outputStream* output, bool heap) :
      DCmdWithParser(output, heap),
    _human_readable("-H", "Human readable format", "BOOLEAN", false, "false"),
    _minsize("-s", "Minimum memory size", "MEMORY SIZE", false, "0") {
    _dcmdparser.add_dcmd_option(&_human_readable);
< prev index next >