hotspot/src/share/vm/services/diagnosticCommand.cpp
changeset 31790 4a08476437e8
parent 31371 311143309e73
child 32072 bc13add2c295
child 33965 e03572caaf4c
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Tue Jul 14 16:28:53 2015 +0200
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Wed Jul 15 12:24:41 2015 -0700
@@ -74,6 +74,7 @@
   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));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<TouchedMethodsDCmd>(full_export, true, false));
 
   // Enhanced JMX Agent Support
   // These commands won't be exported via the DiagnosticCommandMBean until an
@@ -808,3 +809,35 @@
 }
 
 #endif
+
+class VM_DumpTouchedMethods : public VM_Operation {
+private:
+  outputStream* _out;
+public:
+  VM_DumpTouchedMethods(outputStream* out) {
+    _out = out;
+  }
+
+  virtual VMOp_Type type() const { return VMOp_DumpTouchedMethods; }
+
+  virtual void doit() {
+    Method::print_touched_methods(_out);
+  }
+};
+
+TouchedMethodsDCmd::TouchedMethodsDCmd(outputStream* output, bool heap) :
+                                       DCmdWithParser(output, heap)
+{}
+
+void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) {
+  if (!UnlockDiagnosticVMOptions) {
+    output()->print_cr("VM.touched_methods command requires -XX:+UnlockDiagnosticVMOptions");
+    return;
+  }
+  VM_DumpTouchedMethods dumper(output());
+  VMThread::execute(&dumper);
+}
+
+int TouchedMethodsDCmd::num_arguments() {
+  return 0;
+}