This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
AJP/DiSLProject2022/src-profiler/ex8/Instrumentation.java

19 lines
834 B
Java
Raw Normal View History

2023-01-02 09:46:59 +00:00
package ex8;
2023-01-09 07:01:15 +00:00
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.marker.BytecodeMarker;
import org.objectweb.asm.Opcodes;
2023-01-02 09:46:59 +00:00
public class Instrumentation {
2023-01-09 07:01:15 +00:00
@Before(marker = BytecodeMarker.class, args = "invokestatic,invokespecial,invokevirtual,invokedynamic", scope = "*")
static void handleInvoke(InvocationContext ic) {
switch (ic.getInvocationOp()){
case Opcodes.INVOKEDYNAMIC -> Profiler.countInvoke(Thread.currentThread().getName(), "dynamic");
case Opcodes.INVOKEVIRTUAL -> Profiler.countInvoke(Thread.currentThread().getName(), "virtual");
case Opcodes.INVOKESTATIC -> Profiler.countInvoke(Thread.currentThread().getName(), "static");
case Opcodes.INVOKESPECIAL -> Profiler.countInvoke(Thread.currentThread().getName(), "special");
}
}
2023-01-02 09:46:59 +00:00
}