Giter Club home page Giter Club logo

powerjoular's People

Contributors

adelnoureddine avatar benjaminantunes avatar gcorrall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

powerjoular's Issues

Explore monitoring non-computing devices

We are building power models for non-computing devices, such as monitors or speakers.
Explore how to collect main characteristics of these devices from the OS that are used in power models, and integrate them into PowerJoular.

Monitor the power consumption of applications by their names

Add a new feature to support monitoring the power consumption of applications by name, rather than just PID.
Currently, PowerJoular can monitor a particular process by its PID.
The idea is to monitor an application by getting all of its PIDs in Linux, then monitor those PIDs.

powerjoular usage in vms or aws ec2 instances

Hi,
I am not getting output from powerjoular for my ec2 instance. its running on ubuntu.

ubuntu@ip-172-31-40-7:~/powerjoular/installer$ sudo powerjoular
System info:
Platform: intel
Total Power: 0.00 Watts (CPU: 0.00 W) /\ 0.00 Watts^C

Total energy: 0.00 Joules, including:
CPU energy: 0.00 Joules
GPU energy: 0.00 Joules

I tried attaching pid to powerjoular command, and make powerjoular running for quite some time.
But, still same output. Values are always coming as zero.

There are no files inside, /sys/class/power* folders.
ubuntu@ip-172-31-40-7:/sys/class/power_supply$ ls -lrt
total 0
ubuntu@ip-172-31-40-7:/sys/class/power_supply$ cd -
/sys/class/powercap
ubuntu@ip-172-31-40-7:/sys/class/powercap$ ls -lrt
total 0

Any suggestions?

Thanks,
AK

Update git link on Alire

As we moved back to GitHub, we need to update git link in Alire's index. Todo with the release of version 0.5.

Remove power models file and online file update

Currently, power models for Raspberry Pi and Asus Tinker Board are hard coded in the code, but also provided as a JSON file.
This file is parsed and used preferentially, and can be updated online from the tool.

This functionality is rarely used, and forces a dependency on GNATColl library (which is not trivial to compile and install on systems without Ada support in their repos, such as RHEL and clones, unless using Alire).

The objectif is thus to remove this functionality and the GNATColl dependency.

Support untrained revisions of Raspberry Pi

Currently, PowerJoular only works on specific revisions of Raspberry Pi devices where the energy model was trained and generated.
Our experiments showed that revisions have a minor impact on the accuracy of the energy models.
Hence the proposition to also use the energy model of a device model if the specific revision was not used to train the model.

Negative power values

I've noticed that on Intel machines with RAPL, powerjoular will periodically log negative values for total power and cpu power. After some testing I think this is because powerjoular is not taking account of when the energy counter (energy_uj) wraps around (reaches max_energy_range_uj). The calculation RAPL_After.total_energy - RAPL_Before.total_energy then becomes negative, as the RAPL_After value is smaller than the RAPL_Before value. On machines with a heavy load this can happen quite frequently.

You can observe this with:

cd /sys/class/powercap/intel-rapl/intel-rapl:0/
watch "cat energy_uj; cat max_energy_range_uj"

When the energy_uj value reaches the max_energy_range_uj value powerjoular logs a negative value; then continues as normal until the next wrap around.

This is a similar issue to mlco2/codecarbon#322, and I imagine it should be fixed in the same way (mlco2/codecarbon#323). If the 'before' power value is less than the 'after' power value then max_energy_range_uj should be added to RAPL_Energy (RAPL_After.total_energy - RAPL_Before.total_energy).

I think you would have to take into account three possible wraparounds:

/sys/class/powercap/intel-rapl/intel-rapl:1/max_energy_range_uj # for psys
/sys/class/powercap/intel-rapl/intel-rapl:0/max_energy_range_uj # for pkg
/sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:2/max_energy_range_uj # for dram

powerjoular on Raspberry Pi 4

Hello.
I installed powerjoular by build-install.sh on Raspberry Pi 4.
But It shows unsupported when used.

ricky@raspberrypi:~ $ sudo powerjoular
Platform not supported

My Raspberry Pi version is followed:

ricky@raspberrypi:~ $ cat /proc/device-tree/model
Raspberry Pi 4 Model B Rev 1.5

Any suggestions? Thanks.

Option to disable all terminal output

Currently, system info (platform, intel RAPL, PID monitored) are printed on the screen on every run.
Suggestion to add an option to hide them (or enable them if hide is default).

'NaN***' and '+Inf**'

I've been using powerjoular to log power consumption on a few machines; this is run via systemd, and the data is stored in a csv file (and then processed by collectd)..

Recently I noticed one machine (Ubuntu 20.04, Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) was regularly logging "NaN***" and "+Inf**" in the CSV file for the CPU utilisation, which in turn was causing the collectd plugin to log parsing errors ('Ignoring trailing garbage').

After some experimentation I think the problem originates in this line in powerjoular.adb:

CPU_Utilization := (Float (CPU_CCI_After.cbusy) - Float (CPU_CCI_Before.cbusy)) / (Float (CPU_CCI_After.ctotal) - Float (CPU_CCI_Before.ctotal));

If the before and after numbers are close enough together the Float conversion results in either CPU_CCI_After.cbusy and CPU_CCI_Before.cbusy being the same, or CPU_CCI_After.ctotal and CPU_CCI_Before.ctotal being the same; this would cause there to be a zero in the division and give a "NaN***" or "+Inf**".

The actual Long_Integers aren't the same; the Float conversion approximates them to the same value. E.g:

Put(Float(Long_Integer(15534323370)), Exp => 0, Fore => 0);
Put(Float(Long_Integer(15534324162)), Exp => 0, Fore => 0);

Both give the same answer (15534323712.00000), and caused the CPU_Utilization calculation to give me an +Inf**.

I think this case needs to be checked for, so that the division is avoided if a zero is involved. I assume this is also an issue with other similar calculations in the code.

Alternatively maybe greater precision could be used in the type conversions - Long_Float instead of Float. I crudely fixed this by changing all the Floats to Long_Floats (by running "sed -i 's/Float/Long_Float/g' src/*"). It did stop the problem.

Explore replacing GNATColl's JSON dependency with a lighter library

We use GNATColl library in PowerJoular but only for parsing JSON files. As this is quite a big library, we aim to explorer switching to a simpler and lighter JSON library.

The main candidate is json-ada library which is smaller and has compatible license, with an aim to integrate its code rather than an external dependency.

Properly handle multi-threading statistics in Linux

In Linux, PID CPU stats include child PIDs. However, the specific child stats (through thread TID) are not actualized in real time.
The goal is to explore what are the limits of current PID stats, how to integrate children process monitoring (light process/threads), and how to properly integrate that in PowerJoular.

Powerjoular on RAPL supported Intel processor

Hello
We ran the powerjoular to measure the power consumption of the PID of our Python script using the command -

profiler_cmd = f'powerjoular -tp {self.target.pid} -f {context.run_dir / "powerjoular.csv"}'
self.profiler = subprocess.Popen(shlex.split(profiler_cmd))

Test results in powerjoular.csv-{self.target.pid}.csv have some +Inf values for CPU Utilization and Nan values for CPU Power as seen in the screenshot (it appears to follow some pattern)
power-joular-resultsDataIssue (2)

Are we doing something wrong with the way we use it? Could you please help us in understanding the reason for this?

Thank you!

Support for Nvidia Jetson

I get an error Platform not supported when running on an Nvidia Jetson Xavier. I assumed as it was an ARM architecture as Raspberry Pi, Powerjoular would work on it, but that's not the case.

Question regarding Raspberry Pi power measurement

Hi,

Thanks for the interesting project.

I want to use Powerjoular for another ARM SoC (not Raspberry Pi), so I'm curious how you came up with the regression model for RPi. Also, does the power measurement for RPi contain everything on board, including DRAM, or just the processor?

Thanks!

Run PowerJoular on Intel/AMD Linux without root/sudo

Access to RAPL data is restricted in Linux kernel to only privileged users (sudo/root), in order to avoid the PLATYPUS vulnerability.

To avoid running PowerJoular with sudo or root, a proposed approach is to set RAPL files to read for all users. Read status is reset on reboot, so the proposition is to add this right to /etc/sysfs.conf : mode class/powercap/intel-rapl:0/energy_uj = 0444.

In PowerJoular, we read 2 files for each RAPL domain: name and energy_uj. Both files need to have read rights.

Mainly theses files (if they exist):

/sys/class/powercap/intel-rapl/intel-rapl:1/energy_uj
/sys/class/powercap/intel-rapl/intel-rapl:0/energy_uj
/sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:2/energy_uj
/sys/class/powercap/intel-rapl/intel-rapl:1/name
/sys/class/powercap/intel-rapl/intel-rapl:0/name
/sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:2/name

If you only use the PowerJoular systemd service, which needs to be enabled and run as root/sudo as all systemd services, then you can keep your system unchanged as the service will run with privileged rights and writes data to /tmp folder as we explained in the project's page.

Fedora Linux 37 build failed

Hello

Stack trace:

06:24:41 mabed@tower git → neofetch 
             .',;::::;,'.                mabed@tower 
         .';:cccccccccccc:;,.            ----------- 
      .;cccccccccccccccccccccc;.         OS: Fedora Linux 37 (KDE Plasma) x86_64 
    .:cccccccccccccccccccccccccc:.       Host: MS-7D25 2.0 
  .;ccccccccccccc;.:dddl:.;ccccccc;.     Kernel: 6.1.8-200.fc37.x86_64 
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.    Uptime: 27 mins 
.:ccccccccccccc;KMMc;cc;xMMc:ccccccc:.   Packages: 2024 (rpm), 7 (snap) 
,cccccccccccccc;MMM.;cc;;WW::cccccccc,   Shell: bash 5.2.15 
:cccccccccccccc;MMM.;cccccccccccccccc:   Resolution: 2560x1440, 1920x1080 
:ccccccc;oxOOOo;MMM0OOk.;cccccccccccc:   DE: Plasma 5.26.5 
cccccc:0MMKxdd:;MMMkddc.;cccccccccccc;   WM: KWin 
ccccc:XM0';cccc;MMM.;cccccccccccccccc'   Theme: [Plasma], Adwaita [GTK2] 
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;    Icons: [Plasma], breeze-dark [GTK2/3] 
ccccc;0MNc.ccc.xMMd:ccccccccccccccc;     Terminal: konsole 
cccccc;dNMWXXXWM0::cccccccccccccc:,      CPU: 12th Gen Intel i7-12700K (20) @ 4.900GHz 
cccccccc;.:odl:.;cccccccccccccc:,.       GPU: NVIDIA GeForce GTX 1080 
:cccccccccccccccccccccccccccc:'.         GPU: Intel AlderLake-S GT1 
.:cccccccccccccccccccccc:;,..            Memory: 2832MiB / 31878MiB 
  '::cccccccccccccc::;,.
                                                                                                                                 

06:24:45 mabed@tower git → cd powerjoular/
/home/mabed/git/powerjoular
06:24:47 mabed@tower powerjoular ±|main|→ sudo dnf install fedora-gnat-project-common gprbuild gnatcoll gnatcoll-devel gcc-gnat
Dernière vérification de l’expiration des métadonnées effectuée il y a 1:12:03 le lun. 30 janv. 2023 17:12:54.
Le paquet fedora-gnat-project-common-3.15-5.fc37.noarch est déjà installé.
Le paquet gprbuild-2020-11.fc37.x86_64 est déjà installé.
Le paquet gnatcoll-2:21.0.0-7.fc37.x86_64 est déjà installé.
Le paquet gnatcoll-devel-2:21.0.0-7.fc37.x86_64 est déjà installé.
Le paquet gcc-gnat-12.2.1-4.fc37.x86_64 est déjà installé.
Dépendances résolues.
Rien à faire.
Terminé !
06:24:58 mabed@tower powerjoular ±|main|→ mkdir -p obj
mkdir: création du répertoire 'obj'
06:25:04 mabed@tower powerjoular ±|main|→ gprbuild
using project file powerjoular.gpr
directories.gpr:27:04: no value defined for "hardware_platform"
directories.gpr:27:41: undefined external reference "HARDWARE_PLATFORM"
gprbuild: "powerjoular.gpr" processing failed
06:25:09 mabed@tower powerjoular ±|main|→ sudo gprbuild
using project file powerjoular.gpr
directories.gpr:27:04: no value defined for "hardware_platform"
directories.gpr:27:41: undefined external reference "HARDWARE_PLATFORM"
gprbuild: "powerjoular.gpr" processing failed

Regards

Make PowerJoular work in VM

Currently, PowerJoular only works on host systems directly for Intel and AMD PC and servers, as it requires access to RAPL.
RAPL is read through powercap that is only available on hosts and not in guest OS in virtual machines.

As the challenges are shared with JoularJX, we'll centralize information about solutions in the related issue at JoularJX's repo.

Terminal output overlapping

When printing data to the terminal (using the -t flag) the current line is written over the previous line. When the digits change in length, the line becomes a mixture of the current and previous lines. For example, note the "W)W)" and "Wattss" in the following line:

Total Power: 8.50 Watts (CPU: 8.50 W)W)    /\ 0.30 Wattss

I think the most straightforward way to address this would be to use an ANSI escape code to erase the current line (https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797) - say, printing ANSI ESC[0K after printing the carriage return. Though of course there are several other ways this could be fixed.

APP/PID_CPU_Utilization uses random values

CPU_Utilization for both PID and APP is calculated with random values, due to Monitored_Time not being initiatlized

PID_CPU_Utilization := (Float (CPU_PID_Monitor.Monitored_Time)) / (Float (CPU_CCI_After.ctotal) - Float (CPU_CCI_Before.ctotal));

App_CPU_Utilization := (Float (CPU_App_Monitor.Monitored_Time)) / (Float (CPU_CCI_After.ctotal) - Float (CPU_CCI_Before.ctotal));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.