< prev index next >

src/share/vm/services/diagnosticCommand.cpp

Print this page

        

@@ -109,11 +109,11 @@
   uint32_t jmx_agent_export_flags = DCmd_Source_Internal | DCmd_Source_AttachAPI;
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartRemoteDCmd>(jmx_agent_export_flags, true,false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStartLocalDCmd>(jmx_agent_export_flags, true,false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStopRemoteDCmd>(jmx_agent_export_flags, true,false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JMXStatusDCmd>(jmx_agent_export_flags, true,false));
-
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<VTBufferStatsDCmd>(full_export, true, false));
 }
 
 #ifndef HAVE_EXTRA_DCMD
 void DCmdRegistrant::register_dcmds_ext(){
    // Do nothing here

@@ -1011,5 +1011,34 @@
 }
 
 int TouchedMethodsDCmd::num_arguments() {
   return 0;
 }
+
+VTBufferStatsDCmd::VTBufferStatsDCmd(outputStream* output, bool heap) :
+                                    DCmd(output, heap)  { }
+
+void VTBufferStatsDCmd::execute(DCmdSource source, TRAPS) {
+
+  VM_VTBufferStats op1(output());
+  VMThread::execute(&op1);
+
+  int in_pool;
+  int max_in_pool;
+  int total_allocated;
+  int total_deallocated;
+  int total_failed;
+  {
+    MutexLockerEx ml(VTBuffer::lock(), Mutex::_no_safepoint_check_flag);
+    in_pool = VTBuffer::in_pool();
+    max_in_pool = VTBuffer::max_in_pool();
+    total_allocated = VTBuffer::total_allocated();
+    total_deallocated = VTBuffer::total_deallocated();
+    total_failed = VTBuffer::total_failed();
+  }
+  output()->print_cr("Global VTBuffer Pool statistics:");
+  output()->print_cr("\tChunks in pool   : %d", in_pool);
+  output()->print_cr("\tMax in pool      : %d", max_in_pool);
+  output()->print_cr("\tTotal allocated  : %d", total_allocated);
+  output()->print_cr("\tTotal deallocated: %d", total_deallocated);
+  output()->print_cr("\tTotal failed     : %d", total_failed);
+}
< prev index next >