(String[] args)
| 14 | public class JavaAgent { |
| 15 | |
| 16 | public static void main(String[] args) throws Exception { |
| 17 | MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); |
| 18 | ObjectName obj = new ObjectName("one.profiler:type=AsyncProfiler"); |
| 19 | |
| 20 | String version = (String) mbs.getAttribute(obj, "Version"); |
| 21 | System.out.println(String.format("async-profiler version: %s", version)); |
| 22 | |
| 23 | for (int i = 0; i < 3; i++) { |
| 24 | BusyLoops.method1(); |
| 25 | BusyLoops.method2(); |
| 26 | BusyLoops.method3(); |
| 27 | } |
| 28 | |
| 29 | String profile = (String) mbs.invoke( |
| 30 | obj, |
| 31 | "dumpCollapsed", |
| 32 | new String[] { Counter.SAMPLES.name() }, |
| 33 | new String[] { String.class.getName() } |
| 34 | ); |
| 35 | System.out.println(profile); |
| 36 | } |
| 37 | } |
nothing calls this directly
no test coverage detected