This commit is contained in:
Claudio Maggioni 2023-12-19 16:27:18 +01:00
parent a723a02fdd
commit 604bb84031
2 changed files with 13 additions and 2 deletions

View file

@ -26,8 +26,18 @@ find . -name '*.java' -print -exec javac -d ../../out/production/profiler \{\} \
cd ../.. cd ../..
``` ```
## Run application with agent ## Application
### Compile the application
```shell ```shell
java -javaagent:agent/agent.jar=hello -cp out/production/application:out/production/profiler ch.usi.inf.sp.dbi.Application cd application/src
find . -name '*.java' -print -exec javac -d ../../out/production/application \{\} \;
cd ../..
```
### Run application with agent
```shell
java -javaagent:agent/agent.jar=hello -cp out/production/application -Xbootclasspath/p:out/production/profiler ch.usi.inf.sp.dbi.Application
``` ```

View file

@ -44,6 +44,7 @@ public class ClassTransformer implements ClassFileTransformer {
byte[] classfileBuffer) throws IllegalClassFormatException { byte[] classfileBuffer) throws IllegalClassFormatException {
if (className.startsWith("java/") || if (className.startsWith("java/") ||
className.startsWith("sun/") || className.startsWith("sun/") ||
className.startsWith("jdk/") ||
className.startsWith("ch/usi/inf/sp/dbi/agent/") || className.startsWith("ch/usi/inf/sp/dbi/agent/") ||
className.startsWith("ch/usi/inf/sp/dbi/profiler/")) { className.startsWith("ch/usi/inf/sp/dbi/profiler/")) {
System.out.println("Skipping class <" + loader + ", " + className + ">"); System.out.println("Skipping class <" + loader + ", " + className + ">");