AJP/DiSLProject2022/src-profiler/ex3/Instrumentation.java
tripparsugo c8432e032b "I am ready to meet my Maker. Whether my Maker is prepared for the
great ordeal of meeting me is another matter."
		-- Winston Churchill
2023-01-04 17:23:12 +01:00

15 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());
}
}
}