Go to file
Claudio Maggioni dd998eff82 completed lab 6 2024-01-03 12:51:13 +01:00
.idea Added asm library 2023-12-13 12:05:53 +01:00
agent completed lab 6 2024-01-03 12:51:13 +01:00
application completed lab 6 2024-01-03 12:51:13 +01:00
profiler completed lab 6 2024-01-03 12:51:13 +01:00
.gitignore completed lab 6 2024-01-03 12:51:13 +01:00
README.md completed lab 6 2024-01-03 12:51:13 +01:00
lab-6-maggicl.iml agent works 2023-12-13 11:41:52 +01:00

README.md

Lab 6 - Software Performance 2023

This is Lab 6 of the Software Performance course at USI.

Submission Info

Property Value
First Name Claudio
Last Name Maggioni

Setup

To run this application, Java 1.8 is required. The following commands assume that the file java-home-path.txt contains an absolute path pointing to a valid JAVA_HOME for Java 1.8. To automatically do this on macOS run:

/usr/libexec/java_home -V

to list all installed JVMs. Then run this command to populate java-home-path.txt:

/usr/libexec/java_home -v $VERSION > java-home-path.txt

Here $VERSION is the JVM version number for the Java 1.8 JVM chosen from the previous list.

The following sections explain how to compile each module of this project. The shell blocks may be executed with IntelliJ IDEA's RunMarkdown feature by opening this file and clicking on the green run button to the side of each shell block.

How to compile the agent as JAR

export JAVA_HOME=`cat java-home-path.txt`
export PATH="${JAVA_HOME}/bin:$PATH"
cd agent/src
find . -name '*.java' -print -exec javac -cp ../lib/\*:. -d ../../out/production/agent \{\} \;
cd ..
jar cfm agent.jar manifest.txt -C ../out/production/agent .
jar tf agent.jar

How to compile the profiler classes

export JAVA_HOME=`cat java-home-path.txt`
export PATH="${JAVA_HOME}/bin:$PATH"
cd profiler/src
find . -name '*.java' -print -exec javac -d ../../out/production/profiler \{\} \;
cd ../..

How to compile the application classes

export JAVA_HOME=`cat java-home-path.txt`
export PATH="${JAVA_HOME}/bin:$PATH"
cd application/src
find . -name '*.java' -print -exec javac -d ../../out/production/application \{\} \;
cd ../..

Running

To run the application compile the agent, the profiler and the application and then execute:

export JAVA_HOME=`cat java-home-path.txt`
export PATH="${JAVA_HOME}/bin:$PATH"
java -javaagent:agent/agent.jar=hello \
  -cp out/production/application \
  -Xbootclasspath/p:out/production/profiler \
  ch.usi.inf.sp.dbi.Application

The output of this command will include the program output and the calling context tree for the application execution.