sp-06/README.md

78 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2024-01-03 11:51:13 +00:00
# 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:
```shell
2024-01-03 11:51:13 +00:00
/usr/libexec/java_home -V
```
2024-01-03 11:51:13 +00:00
to list all installed JVMs. Then run this command to populate `java-home-path.txt`:
```shell
/usr/libexec/java_home -v $VERSION > java-home-path.txt
```
2023-12-13 10:41:52 +00:00
2024-01-03 11:51:13 +00:00
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
2023-12-13 10:41:52 +00:00
```shell
2024-01-03 11:51:13 +00:00
export JAVA_HOME=`cat java-home-path.txt`
2024-01-03 09:14:18 +00:00
export PATH="${JAVA_HOME}/bin:$PATH"
2023-12-13 10:41:52 +00:00
cd agent/src
find . -name '*.java' -print -exec javac -cp ../lib/\*:. -d ../../out/production/agent \{\} \;
2023-12-13 10:41:52 +00:00
cd ..
jar cfm agent.jar manifest.txt -C ../out/production/agent .
2024-01-03 09:14:18 +00:00
jar tf agent.jar
2023-12-13 10:41:52 +00:00
```
2024-01-03 11:51:13 +00:00
## How to compile the profiler classes
```shell
2024-01-03 11:51:13 +00:00
export JAVA_HOME=`cat java-home-path.txt`
2024-01-03 09:14:18 +00:00
export PATH="${JAVA_HOME}/bin:$PATH"
cd profiler/src
find . -name '*.java' -print -exec javac -d ../../out/production/profiler \{\} \;
cd ../..
```
2024-01-03 11:51:13 +00:00
## How to compile the application classes
2023-12-19 15:27:18 +00:00
```shell
2024-01-03 11:51:13 +00:00
export JAVA_HOME=`cat java-home-path.txt`
2024-01-03 09:14:18 +00:00
export PATH="${JAVA_HOME}/bin:$PATH"
2023-12-19 15:27:18 +00:00
cd application/src
find . -name '*.java' -print -exec javac -d ../../out/production/application \{\} \;
cd ../..
```
2024-01-03 11:51:13 +00:00
### Running
To run the application compile the agent, the profiler and the application and then execute:
2023-12-13 10:41:52 +00:00
```shell
2024-01-03 11:51:13 +00:00
export JAVA_HOME=`cat java-home-path.txt`
2024-01-03 09:14:18 +00:00
export PATH="${JAVA_HOME}/bin:$PATH"
2024-01-03 11:51:13 +00:00
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.