diff --git a/README.md b/README.md
index 7f665f8..ea55950 100755
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@ JoularJX can be configured by modifying the ```config.properties``` files:
- ```vm-power-format```: power format of the shared VM power file. We currently support two formats: ```watts``` (a file containing one float value which is the power consumption of the VM), and ```powerjoular``` (a csv file generated by [PowerJoular](https://github.com/joular/powerjoular) in the host, containing 3 columns: timestamp, CPU utilization of the VM and CPU power of the VM).
You can install the jar package (and the PowerMonitor.exe on Windows) wherever you want, and call it in the ```javaagent``` with the full path.
-However, ```config.properties``` must be copied to the same folder as where you run the Java command.
+However, ```config.properties``` must either be copied to the same folder as where you run the Java command or its location must be set with the ```-Djoularjx.config=/path/to/config.properties``` property when running your program.
In virtual machines, JoularJX requires two steps:
- Installing a power monitoring tool in the host machine, which will monitor the virtual machine power consumption every second and writing it to a file (to be shared with the guest VM).
diff --git a/config.properties b/config.properties
index 7946548..e3f9c39 100644
--- a/config.properties
+++ b/config.properties
@@ -77,7 +77,7 @@ powermonitor-path=C:\\joularjx\\PowerMonitor.exe
# Monitoring inside virtual machines
# Values: true, false
-vm-monitoring=true
+vm-monitoring=false
# Path for power consumption of the virtual machine
# Inside a virtual machine, indicate the file containing power consumption of the VM
diff --git a/pom.xml b/pom.xml
index 9c4a1d5..6dd07a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
org.noureddine
joularjx
- 3.0.0
+ 3.0.1
jar
${project.artifactId}
@@ -61,7 +61,7 @@
com.github.marschall
memoryfilesystem
- 2.8.0
+ 2.8.1
test
@@ -71,7 +71,7 @@
org.junit
junit-bom
- 5.10.2
+ 5.11.3
import
pom
@@ -110,7 +110,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.3.0
+ 3.5.2
diff --git a/src/main/java/org/noureddine/joularjx/Agent.java b/src/main/java/org/noureddine/joularjx/Agent.java
index 9a14ab9..29b5ae7 100644
--- a/src/main/java/org/noureddine/joularjx/Agent.java
+++ b/src/main/java/org/noureddine/joularjx/Agent.java
@@ -46,7 +46,7 @@ public static void premain(String args, Instrumentation inst) {
JoularJXLogging.updateLevel(properties.getLoggerLevel());
logger.info("+---------------------------------+");
- logger.info("| JoularJX Agent Version 3.0.0 |");
+ logger.info("| JoularJX Agent Version 3.0.1 |");
logger.info("+---------------------------------+");
ThreadMXBean threadBean = createThreadBean();
diff --git a/src/main/java/org/noureddine/joularjx/cpu/RaplLinux.java b/src/main/java/org/noureddine/joularjx/cpu/RaplLinux.java
index 06bbe52..cba519d 100644
--- a/src/main/java/org/noureddine/joularjx/cpu/RaplLinux.java
+++ b/src/main/java/org/noureddine/joularjx/cpu/RaplLinux.java
@@ -79,30 +79,51 @@ public void initialize() {
final Path psysFile = fileSystem.getPath(RAPL_PSYS);
final Path psysMaxFile = fileSystem.getPath(RAPL_PSYS_MAX);
if (Files.exists(psysFile)) {
- checkFileReadable(psysFile);
- checkFileReadable(psysMaxFile);
// psys exists, so use this for energy readings
- raplFilesToRead.add(psysFile);
- maxRaplFilesToRead.add(psysMaxFile);
+ if (Files.isReadable(psysFile)) {
+ raplFilesToRead.add(psysFile);
+ if (Files.isReadable(psysMaxFile)) {
+ maxRaplFilesToRead.add(psysMaxFile);
+ } else {
+ logger.log(Level.SEVERE, "Failed to get read" + psysMaxFile + " file. Exiting... Did you run JoularJX with elevated privileges (sudo)?");
+ System.exit(1);
+ }
+ } else {
+ logger.log(Level.SEVERE, "Failed to get RAPL energy readings from" + psysFile + " file. Exiting... Did you run JoularJX with elevated privileges (sudo)?");
+ System.exit(1);
+ }
} else {
// No psys supported, then check for pkg and dram
final Path pkgFile = fileSystem.getPath(RAPL_PKG);
final Path pkgMaxFile = fileSystem.getPath(RAPL_PKG_MAX);
if (Files.exists(pkgFile)) {
- checkFileReadable(pkgFile);
- checkFileReadable(pkgMaxFile);
- // pkg exists, check also for dram
- raplFilesToRead.add(pkgFile);
- maxRaplFilesToRead.add(pkgMaxFile);
+ if (Files.isReadable(pkgFile)) {
+ raplFilesToRead.add(pkgFile);
+ if (Files.isReadable(pkgMaxFile)) {
+ maxRaplFilesToRead.add(pkgMaxFile);
+ } else {
+ logger.log(Level.SEVERE, "Failed to get read" + pkgMaxFile + " file. Exiting... Did you run JoularJX with elevated privileges (sudo)?");
+ System.exit(1);
+ }
+ } else {
+ logger.log(Level.SEVERE, "Failed to get RAPL energy readings from" + pkgFile + " file. Exiting... Did you run JoularJX with elevated privileges (sudo)?");
+ System.exit(1);
+ }
final Path dramFile = fileSystem.getPath(RAPL_DRAM);
final Path dramMaxFile = fileSystem.getPath(RAPL_DRAM_MAX);
if (Files.exists(dramFile)) {
- checkFileReadable(dramFile);
- checkFileReadable(dramMaxFile);
- // dram and pkg exists, then get sum of both
- raplFilesToRead.add(dramFile);
- maxRaplFilesToRead.add(dramMaxFile);
+ if (Files.isReadable(dramFile)) {
+ raplFilesToRead.add(dramFile);
+ if (Files.isReadable(dramMaxFile)) {
+ maxRaplFilesToRead.add(dramMaxFile);
+ } else {
+ logger.log(Level.SEVERE, "Failed to get read" + dramMaxFile + " file. Exiting... Did you run JoularJX with elevated privileges (sudo)?");
+ System.exit(1);
+ }
+ } else {
+ logger.log(Level.WARNING, "Failed to get RAPL energy readings from" + dramFile + " file. Continuing without it.");
+ }
}
}
}
@@ -113,18 +134,6 @@ public void initialize() {
}
}
- /**
- * Check that the passed file can be read by the program. Log error message and exit if reading the file is not
- * possible.
- * @param file the file to check the read access
- */
- private void checkFileReadable(final Path file) {
- if (!Files.isReadable(file)) {
- logger.log(Level.SEVERE, "Failed to get RAPL energy readings. Did you run JoularJX with elevated privileges (sudo)?");
- System.exit(1);
- }
- }
-
/**
* Get energy readings from RAPL through powercap
* Calculates the best energy reading as supported by CPU (psys, or pkg+dram, or pkg)
diff --git a/src/main/java/org/noureddine/joularjx/utils/AgentProperties.java b/src/main/java/org/noureddine/joularjx/utils/AgentProperties.java
index b2b276d..fba9628 100644
--- a/src/main/java/org/noureddine/joularjx/utils/AgentProperties.java
+++ b/src/main/java/org/noureddine/joularjx/utils/AgentProperties.java
@@ -232,7 +232,7 @@ public int loadStackMonitoringSampleRate() {
}
private Optional getPropertiesPathIfExists(FileSystem fileSystem) {
- Path path = fileSystem.getPath("config.properties");
+ Path path = fileSystem.getPath(System.getProperty("joularjx.config", "config.properties"));
if (Files.notExists(path)) {
logger.log(Level.INFO, "Could not locate config.properties, will use default values");