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/ex3/Instrumentation.java

14 lines
509 B
Java

package ex3;
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BytecodeMarker;
public class Instrumentation {
@Before(marker = BytecodeMarker.class, args = "astore", scope = "ex3.MainThread.checkAccess")
static void printVariable(final DynamicContext dc) {
if ("granted".equals(dc.getStackValue(0, Object.class))) {
System.out.printf("Thread: %s\n", Thread.currentThread().getName());
}
}
}