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

15 lines
509 B
Java
Raw Permalink Normal View History

2023-01-02 09:46:59 +00:00
package ex3;
2023-01-02 14:59:03 +00:00
import ch.usi.dag.disl.annotation.Before;
import ch.usi.dag.disl.dynamiccontext.DynamicContext;
import ch.usi.dag.disl.marker.BytecodeMarker;
2023-01-02 09:46:59 +00:00
public class Instrumentation {
2023-01-02 14:59:03 +00:00
@Before(marker = BytecodeMarker.class, args = "astore", scope = "ex3.MainThread.checkAccess")
2023-01-04 16:23:12 +00:00
static void printVariable(final DynamicContext dc) {
2023-01-02 14:59:03 +00:00
if ("granted".equals(dc.getStackValue(0, Object.class))) {
System.out.printf("Thread: %s\n", Thread.currentThread().getName());
}
}
2023-01-02 09:46:59 +00:00
}