PACMON is an extension of PowerApi. PACMON allows to easily measure the energy consumed by a Java application at the thread-level.
The source code is instrumented using ByteBuddy. The main method of the application is instrumented to send a start signal at its beginning and a stop signal at its end to a server based monitor. All the methods of the application are also instrumented to send their begin and end timestamps to the server.
To start the server, simply run the main method of pacmon/jvmMonitor/src/main/java/org/atlanmod/HttpBasedMonitor.java . Once the server is running, instrument the source code using :
java -javaagent:target/Jar_Absolute_Path=Jar_Package_Name,Name_Of_The_Main_Method,Level_Of_Accuracy -jar Jar_Absolute_Path
Level_Of_Accuracy can either be process or thread, depending on the desired level of accuracy.
For exemple:
java -javaagent:target/energyInstrumentation-1.0-SNAPSHOT-jar-with-dependencies.jar=benchmark,main,thread -jar target/energyInstrumentation-1.0-SNAPSHOT-jar-with-dependencies.jar
Considering PowerAPI power model we determine the following formula:
From this formula, we deduce the following formula for estimating the thread level energy consumption:
We compared Pacmon to jRAPL and PowerAPI (SimpleCPUModule):