sun.jvm.hotspot.HotSpotAgent Java Examples

The following examples show how to use sun.jvm.hotspot.HotSpotAgent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestInstanceKlassSize.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void SAInstanceKlassSize(int pid,
                                        String[] SAInstanceKlassNames) {
    HotSpotAgent agent = new HotSpotAgent();
    try {
        agent.attach(pid);
    }
    catch (DebuggerException e) {
        System.out.println(e.getMessage());
        System.err.println("Unable to connect to process ID: " + pid);

        agent.detach();
        e.printStackTrace();
    }

    for (String SAInstanceKlassName : SAInstanceKlassNames) {
        InstanceKlass ik = SystemDictionaryHelper.findInstanceKlass(
                           SAInstanceKlassName);
        Asserts.assertNotNull(ik,
            String.format("Unable to find instance klass for %s", ik));
        System.out.println("SA: The size of " + SAInstanceKlassName +
                           " is " + ik.getSize());
    }
    agent.detach();
}
 
Example #2
Source File: TestInstanceKlassSizeForInterface.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void SAInstanceKlassSize(int lingeredAppPid,
                                        String[] instanceKlassNames) {

    HotSpotAgent agent = new HotSpotAgent();
    try {
        agent.attach(lingeredAppPid);
    }
    catch (DebuggerException e) {
        System.out.println(e.getMessage());
        System.err.println("Unable to connect to process ID: " + lingeredAppPid);

        agent.detach();
        e.printStackTrace();
    }

    for (String instanceKlassName : instanceKlassNames) {
        InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(
                                   instanceKlassName);
        Asserts.assertNotNull(iKlass,
            String.format("Unable to find instance klass for %s", instanceKlassName));
        System.out.println("SA: The size of " + instanceKlassName +
                           " is " + iKlass.getSize());
    }
    agent.detach();
}
 
Example #3
Source File: Tool.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #4
Source File: Tool.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #5
Source File: Tool.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #6
Source File: Tool.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #7
Source File: TestDefaultMethods.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void printDefaultMethods(String pid,
                                        String[] instanceKlassNames) {
    HotSpotAgent agent = new HotSpotAgent();
    try {
        agent.attach(Integer.parseInt(pid));
    }
    catch (DebuggerException e) {
        System.out.println(e.getMessage());
        System.err.println("Unable to connect to process ID: " + pid);

        agent.detach();
        e.printStackTrace();
    }

    for (String instanceKlassName : instanceKlassNames) {
        InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(instanceKlassName);
        MethodArray methods = iKlass.getMethods();
        MethodArray defaultMethods = iKlass.getDefaultMethods();
        for (int i = 0; i < methods.length(); i++) {
            Method m = methods.at(i);
            System.out.println("Method: " + m.getName().asString() +
                               " in instance klass: " + instanceKlassName);
        }
        if (defaultMethods != null) {
            for (int j = 0; j < defaultMethods.length(); j++) {
                Method dm = defaultMethods.at(j);
                System.out.println("Default method: " + dm.getName().asString() +
                                   " in instance klass: " + instanceKlassName);
            }
        } else {
            System.out.println("No default methods in " + instanceKlassName);
        }

    }
    agent.detach();
}
 
Example #8
Source File: TestCpoolForInvokeDynamic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void printBytecodes(String pid,
                                   String[] instanceKlassNames) {
    HotSpotAgent agent = new HotSpotAgent();
    try {
        agent.attach(Integer.parseInt(pid));
    }
    catch (DebuggerException e) {
        System.out.println(e.getMessage());
        System.err.println("Unable to connect to process ID: " + pid);

        agent.detach();
        e.printStackTrace();
    }

    for (String instanceKlassName : instanceKlassNames) {
        InstanceKlass iKlass = SystemDictionaryHelper.findInstanceKlass(instanceKlassName);
        MethodArray methods = iKlass.getMethods();
        for (int i = 0; i < methods.length(); i++) {
            Method m = methods.at(i);
            System.out.println("Method: " + m.getName().asString() +
                               " in instance klass: " + instanceKlassName);
            HTMLGenerator gen = new HTMLGenerator(false);
            System.out.println(gen.genHTML(m));
        }
    }
    agent.detach();
}
 
Example #9
Source File: Tool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #10
Source File: Tool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #11
Source File: Tool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #12
Source File: Tool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void start() {

      if (jvmDebugger == null) {
         throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
      }
      agent = new HotSpotAgent();
      agent.attach(jvmDebugger);
      startInternal();
   }
 
Example #13
Source File: Tool.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #14
Source File: Tool.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #15
Source File: Tool.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #16
Source File: Tool.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #17
Source File: Tool.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #18
Source File: Tool.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #19
Source File: Tool.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #20
Source File: Tool.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #21
Source File: Tool.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #22
Source File: Tool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #23
Source File: Tool.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #24
Source File: Tool.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #25
Source File: Tool.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #26
Source File: Tool.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}
 
Example #27
Source File: Tool.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void setAgent(HotSpotAgent a) {
   agent = a;
}
 
Example #28
Source File: Tool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected HotSpotAgent getAgent() {
   return agent;
}