Closed metacosm closed 10 months ago
Hi, the power value is in Watts in Windows and on Raspberry. On Linux with RAPL, it's the energy value in Joules from RAPL readings (which by itself is meaningless as that's energy since pc start, and we use to calculate energy difference every second e2 - e1, so we can get enegy/second, thus power).
It doesn't appear to be the case, though, as both initial and current power are measured during the same loop iteration meaning that the measurements occur in quick succession. Also, this means that every other Cpu implementations must return 0 for getInitialPower
, when the Linux RAPL implementation is actually the only one that's supposed to make use of this value.
This also means that the logic / reporting is inconsistent because the agent reports total joules being consumed while in all instances apart from RAPL/Linux, the total is actually Watts, at least, if I understand correctly.
The logic algorithm is:
getInitialPower
will return 0 in this case, and getCurrentPower
will return power consumption in watts (which for 1 second, is = energy).The before/after energy collection is done every second, while we collect methods statistics in a smaller sampling loop with the method sample()
https://github.com/joular/joularjx/blob/63f12854f616d60bddd93b9997605e7e920b82b2/src/main/java/org/noureddine/joularjx/monitor/MonitoringHandler.java#L92
Which will loop for the entire second.
Hope this clarifies our approach.
Is it mW, W, J, something else?