This project provides Java bindings and thin wrappers around the energymon-default
library.
Currently, only Linux is supported.
The energymon-default
library and headers should be installed to the system.
The latest energymon
C libraries can be found at https://github.com/energymon/energymon.
This project uses Maven.
Currently the only supported platforms are the unix
family.
To build and run junit tests:
mvn clean install
If energymon-default
is not installed to a default location, you need to set the PKG_CONFIG_PATH
environment variable or export it to your environment so that pkg-config
can discover the library.
Unless you are skipping tests (-DskipTests=true
), you must do the same for LD_LIBRARY_PATH
.
PKG_CONFIG_PATH=/path/to/energymon/install/lib/pkgconfig:$PKG_CONFIG_PATH \
LD_LIBRARY_PATH=/path/to/energymon/install/lib/:$LD_LIBRARY_PATH \
mvn clean package
To integrate with the library, add it as a Maven dependency to your project's pom.xml
:
<dependency>
<groupId>edu.uchicago.cs.energymon</groupId>
<artifactId>energymon</artifactId>
<version>0.0.1</version>
</dependency>
To use the edu.uchicago.cs.energymon.EnergyMon
interface, instantiate edu.uchicago.cs.energymon.DefaultEnergyMon
.
When launching, you will need to set the property java.library.path
to include the location of the native library created by the module libenergymon-default-wrapper
.
There is an example implementation in the example
directory - see the class edu.uchicago.cs.energymon.EnergyMonJNIExample
.
After building, you can change directory to example/target/energymon-example-0.0.1-bin
and run:
java -Djava.library.path=. \
-cp energymon-example.jar:energymon.jar:energymon-native-jni.jar \
edu.uchicago.cs.energymon.EnergyMonJNIExample
If energymon-default
is not installed to the system, you need to set LD_LIBRARY_PATH
as described above.
Find this and related project sources at the energymon organization on GitHub.
This project originates at: https://github.com/energymon/energymon-jni
Bug reports and pull requests for bug fixes and enhancements are welcome.