MCPcopy Create free account
hub / github.com/btraceio/btrace / onMethod

Method onMethod

btrace-compiler/src/test/resources/HistoProbe.java:11–21  ·  view source on GitHub ↗
(@Self Object obj)

Source from the content-addressed store, hash-verified

9@BTrace public class HistoProbe {
10 private static Map<String, AtomicInteger> histo = newHashMap();
11 @OnMethod(clazz = "javax.swing.JComponent", method = "<init>")
12 public static void onMethod(@Self Object obj) {
13 String cn = name(classOf(obj));
14 AtomicInteger ai = get((Map<String, AtomicInteger>)histo, cn);
15 if (ai == null) {
16 ai = newAtomicInteger(1);
17 put(histo, cn, ai);
18 } else {
19 incrementAndGet(ai); // WORKS if commented out
20 }
21 }
22
23 @OnTimer(1000)
24 public static void print() {

Callers

nothing calls this directly

Calls 6

nameMethod · 0.45
classOfMethod · 0.45
getMethod · 0.45
newAtomicIntegerMethod · 0.45
putMethod · 0.45
incrementAndGetMethod · 0.45

Tested by

no test coverage detected