MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / main

Method main

test/test/api/JavaAgent.java:16–36  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

14public 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}

Callers

nothing calls this directly

Calls 5

method1Method · 0.95
method2Method · 0.95
method3Method · 0.95
getAttributeMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected