Skip to content

Commit

Permalink
Merge pull request #44 from joular/develop
Browse files Browse the repository at this point in the history
Version 0.7.2
  • Loading branch information
adelnoureddine authored Feb 20, 2024
2 parents 7b30c9e + e9f1b9e commit 509d181
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 75 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The difference (increase or decrease) of power consumption from last metric will

The following options are available:
- ```-h```: show the help message
- ```-h```: show version number
- ```-v```: show version number
- ```-p pid```: specifiy a particular PID to monitor
- ```-a appName```: specifiy a particular application name to monitor (will monitor all PIDs of the application)
- ```-f filename```: save monitoring data to the given filename path
Expand Down Expand Up @@ -165,7 +165,7 @@ To cite our work in a research paper, please cite our paper in the 18th Internat

PowerJoular is licensed under the GNU GPL 3 license only (GPL-3.0-only).

Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
All rights reserved. This program and the accompanying materials are made available under the terms of the GNU General Public License v3.0 only (GPL-3.0-only) which accompanies this distribution, and is available at: https://www.gnu.org/licenses/gpl-3.0.en.html

Author : Adel Noureddine
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "powerjoular"
description = "Monitoring the power consumption of multiple platforms and processes"
version = "0.7.1"
version = "0.7.2"

authors = ["Adel Noureddine"]
maintainers = ["Adel Noureddine <adel.noureddine@univ-pau.fr>"]
Expand Down
2 changes: 1 addition & 1 deletion installer/debian-control-amd64.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: powerjoular
Version: 0.7.1
Version: 0.7.2
Maintainer: Adel Noureddine
Architecture: amd64
Description: PowerJoular allows monitoring power consumption of multiple platforms and processes.
2 changes: 1 addition & 1 deletion installer/debian-control-arm64.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: powerjoular
Version: 0.7.1
Version: 0.7.2
Maintainer: Adel Noureddine
Architecture: arm64
Description: PowerJoular allows monitoring power consumption of multiple platforms and processes.
2 changes: 1 addition & 1 deletion installer/debian-control-armhf.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: powerjoular
Version: 0.7.1
Version: 0.7.2
Maintainer: Adel Noureddine
Architecture: armhf
Description: PowerJoular allows monitoring power consumption of multiple platforms and processes.
2 changes: 1 addition & 1 deletion src/cpu_cycles.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
2 changes: 1 addition & 1 deletion src/cpu_cycles.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
2 changes: 1 addition & 1 deletion src/cpu_stat_app.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
4 changes: 2 additions & 2 deletions src/cpu_stat_app.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Universit� de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -23,7 +23,7 @@ package CPU_STAT_App is
Before_Time : Long_Integer; -- Total time, before monitoring
After_Time : Long_Integer; -- Total time, after monitoring
App_Name : Unbounded_String; -- App name to monitor
Power : Float; -- Power consumption in monitoring cycle for PID
Power : Long_Float; -- Power consumption in monitoring cycle for PID
Monitored_Time : Long_Integer; -- Monitored CPU time in the monitoring cycle
PID_Array : PID_Array_Int; -- Array of all PIDs of the application
end record;
Expand Down
2 changes: 1 addition & 1 deletion src/cpu_stat_pid.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
4 changes: 2 additions & 2 deletions src/cpu_stat_pid.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -17,7 +17,7 @@ package CPU_STAT_PID is
Before_Time : Long_Integer; -- Total time, before monitoring
After_Time : Long_Integer; -- Total time, after monitoring
PID_Number : Integer; -- PID to monitor
Power : Float; -- Power consumption in monitoring cycle for PID
Power : Long_Float; -- Power consumption in monitoring cycle for PID
Monitored_Time : Long_Integer; -- Monitored CPU time in the monitoring cycle
end record;

Expand Down
20 changes: 10 additions & 10 deletions src/csv_power.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -11,15 +11,15 @@

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO;
with Ada.Calendar.Formatting; use Ada.Calendar.Formatting;
with Ada.Calendar.Time_Zones; use Ada.Calendar.Time_Zones;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;

package body CSV_Power is

procedure Save_To_CSV_File (Filename : String; Utilization : Float; Total_Power : Float; CPU_Power : Float; GPU_Power : Float; Overwrite_Data : Boolean) is
procedure Save_To_CSV_File (Filename : String; Utilization : Long_Float; Total_Power : Long_Float; CPU_Power : Long_Float; GPU_Power : Long_Float; Overwrite_Data : Boolean) is
F : File_Type; -- File handle
Now : Time := Clock; -- Current UTC time

Expand Down Expand Up @@ -57,7 +57,7 @@ package body CSV_Power is
raise PROGRAM_ERROR with "Error in accessing or creating the CSV file";
end;

procedure Save_PID_To_CSV_File (Filename : String; Utilization : Float; Power : Float; Overwrite_Data : Boolean) is
procedure Save_PID_To_CSV_File (Filename : String; Utilization : Long_Float; Power : Long_Float; Overwrite_Data : Boolean) is
F : File_Type; -- File handle
Now : Time := Clock; -- Current UTC time

Expand Down Expand Up @@ -91,9 +91,9 @@ package body CSV_Power is
raise PROGRAM_ERROR with "Error in accessing or creating the CSV file";
end;

procedure Show_On_Terminal (Utilization : Float; Power : Float; Previous_Power : Float; CPU_Power : Float; GPU_Power : Float; GPU_Supported : Boolean) is
Utilization_Percentage : Float;
Power_Difference : Float;
procedure Show_On_Terminal (Utilization : Long_Float; Power : Long_Float; Previous_Power : Long_Float; CPU_Power : Long_Float; GPU_Power : Long_Float; GPU_Supported : Boolean) is
Utilization_Percentage : Long_Float;
Power_Difference : Long_Float;
begin
Utilization_Percentage := Utilization * 100.0;
Put (CR);
Expand Down Expand Up @@ -124,9 +124,9 @@ package body CSV_Power is
end if;
end;

procedure Show_On_Terminal_PID (PID_Utilization : Float; PID_Power : Float; Utilization : Float; Power : Float; Is_PID : Boolean) is
Utilization_Percentage : Float;
PID_Utilization_Percentage : Float;
procedure Show_On_Terminal_PID (PID_Utilization : Long_Float; PID_Power : Long_Float; Utilization : Long_Float; Power : Long_Float; Is_PID : Boolean) is
Utilization_Percentage : Long_Float;
PID_Utilization_Percentage : Long_Float;
begin
Utilization_Percentage := Utilization * 100.0;
PID_Utilization_Percentage := PID_Utilization * 100.0;
Expand Down
10 changes: 5 additions & 5 deletions src/csv_power.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -12,15 +12,15 @@
package CSV_Power is

-- Save CPU utilization and power conusmption to CSV file
procedure Save_To_CSV_File (Filename : String; Utilization : Float; Total_Power : Float; CPU_Power : Float; GPU_Power : Float; Overwrite_Data : Boolean);
procedure Save_To_CSV_File (Filename : String; Utilization : Long_Float; Total_Power : Long_Float; CPU_Power : Long_Float; GPU_Power : Long_Float; Overwrite_Data : Boolean);

-- Save PID's CPU utilization and power conusmption to CSV file
procedure Save_PID_To_CSV_File (Filename : String; Utilization : Float; Power : Float; Overwrite_Data : Boolean);
procedure Save_PID_To_CSV_File (Filename : String; Utilization : Long_Float; Power : Long_Float; Overwrite_Data : Boolean);

-- Print CPU utilization, CPU, GPU and total power conusmption on the terminal
procedure Show_On_Terminal (Utilization : Float; Power : Float; Previous_Power : Float; CPU_Power : Float; GPU_Power : Float; GPU_Supported : Boolean);
procedure Show_On_Terminal (Utilization : Long_Float; Power : Long_Float; Previous_Power : Long_Float; CPU_Power : Long_Float; GPU_Power : Long_Float; GPU_Supported : Boolean);

-- Print CPU utilization and CPU power conusmption on the terminal of monitored PID
procedure Show_On_Terminal_PID (PID_Utilization : Float; PID_Power : Float; Utilization : Float; Power : Float; Is_PID : Boolean);
procedure Show_On_Terminal_PID (PID_Utilization : Long_Float; PID_Power : Long_Float; Utilization : Long_Float; Power : Long_Float; Is_PID : Boolean);

end CSV_Power;
8 changes: 4 additions & 4 deletions src/help_info.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -14,8 +14,9 @@ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;

package body Help_Info is

Version_Number : constant String := "0.7.2";

procedure Show_Help is
Version_Number : constant String := "0.7.1";
begin
Put_Line (ESC & "[93m" & "~~ PowerJoular ~~" & ESC & "[0m");
Put_Line ("Version " & Version_Number);
Expand Down Expand Up @@ -48,11 +49,10 @@ package body Help_Info is
Put_Line ("PowerJoular is written and maintained by Dr Adel Noureddine from the University of Pau and the Pays de l'Adour");
Put_Line ("--------------------------");
Put_Line (ESC & "[93m" & "Copyright:" & ESC & "[0m");
Put_Line ("Copyright (c) 2020-2023, Adel Noureddine. PowerJoular is licensed under the GNU GPL 3 license only (GPL-3.0-only)");
Put_Line ("Copyright (c) 2020-2024, Adel Noureddine. PowerJoular is licensed under the GNU GPL 3 license only (GPL-3.0-only)");
end;

procedure Show_Version is
Version_Number : constant String := "0.7.1";
begin
Put_Line (Version_Number);
end;
Expand Down
2 changes: 1 addition & 1 deletion src/help_info.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
8 changes: 4 additions & 4 deletions src/intel_rapl_sysfs.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -23,14 +23,14 @@ package body Intel_RAPL_sysfs is
-- Read energy_uj which is in micro joules
Open (F_Name, In_File, Folder_Name & "intel-rapl:1/energy_uj");
-- Store energy value divided by 1000000 to get it in joules
RAPL_Data.psys := Float'Value (Get_Line (F_Name)) / 1000000.0;
RAPL_Data.psys := Long_Float'Value (Get_Line (F_Name)) / 1000000.0;
Close (F_Name);
RAPL_Data.total_energy := RAPL_Data.psys;
elsif RAPL_Data.pkg_supported then
-- Read energy_uj which is in micro joules
Open (F_Name, In_File, Folder_Name & "intel-rapl:0/energy_uj");
-- Store energy value divided by 1000000 to get it in joules
RAPL_Data.pkg := Float'Value (Get_Line (F_Name)) / 1000000.0;
RAPL_Data.pkg := Long_Float'Value (Get_Line (F_Name)) / 1000000.0;
Close (F_Name);
RAPL_Data.total_energy := RAPL_Data.pkg;

Expand All @@ -39,7 +39,7 @@ package body Intel_RAPL_sysfs is
-- Read energy_uj which is in micro joules
Open (F_Name, In_File, Folder_Name & "intel-rapl:0/intel-rapl:0:2/energy_uj");
-- Store energy value divided by 1000000 to get it in joules
RAPL_Data.dram := Float'Value (Get_Line (F_Name)) / 1000000.0;
RAPL_Data.dram := Long_Float'Value (Get_Line (F_Name)) / 1000000.0;
Close (F_Name);
RAPL_Data.total_energy := RAPL_Data.pkg + RAPL_Data.dram;
end if;
Expand Down
10 changes: 5 additions & 5 deletions src/intel_rapl_sysfs.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -15,12 +15,12 @@ package Intel_RAPL_sysfs is
type Intel_RAPL_Data is
record
-- Data to store energy measures
psys : Float; -- Energy for psys (whole SOC)
pkg : Float; -- Energy for all packages
dram : Float; -- Energy for all dram
psys : Long_Float; -- Energy for psys (whole SOC)
pkg : Long_Float; -- Energy for all packages
dram : Long_Float; -- Energy for all dram

-- Total energy is equal to psys if supoprted, or to pkg + dram
total_energy : Float := 0.0; -- Total energy
total_energy : Long_Float := 0.0; -- Total energy

-- Data to store if packages are supported
psys_supported : Boolean := False; -- if system supports psys
Expand Down
8 changes: 4 additions & 4 deletions src/nvidia_smi.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -17,14 +17,14 @@ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;

package body Nvidia_SMI is

function Get_Nvidia_SMI_Power return Float is
function Get_Nvidia_SMI_Power return Long_Float is
Command : String := "nvidia-smi --format=csv,noheader,nounits --query-gpu=power.draw";
Args : Argument_List_Access;
Status : aliased Integer;
Subs : String_Split.Slice_Set; -- Used to slice the read data from stat file
Seps : constant String := CR & LF; -- Seperator (space) for slicing string
Slice_number_count : String_Split.Slice_Number;
GPU_Energy : Float := 0.0;
GPU_Energy : Long_Float := 0.0;
begin
Args := Argument_String_To_List (Command);
declare
Expand All @@ -47,7 +47,7 @@ package body Nvidia_SMI is
Slice_number_count := String_Split.Slice_Count (Subs);

for I in 1 .. Slice_number_count loop
GPU_Energy := GPU_Energy + Float'Value (String_Split.Slice (Subs, 1));
GPU_Energy := GPU_Energy + Long_Float'Value (String_Split.Slice (Subs, 1));
end loop;

return GPU_Energy;
Expand Down
4 changes: 2 additions & 2 deletions src/nvidia_smi.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand All @@ -12,7 +12,7 @@
package Nvidia_SMI is

-- Function to return the current Nvidia board power consumption using nvidia-smi
function Get_Nvidia_SMI_Power return Float;
function Get_Nvidia_SMI_Power return Long_Float;

-- Function to check if we have a supported Nvidia card and drivers and nvidia-smi tool
function Check_Nvidia_Supported_System return Boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/os_utils.adb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
2 changes: 1 addition & 1 deletion src/os_utils.ads
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--
-- Copyright (c) 2020-2023, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- Copyright (c) 2020-2024, Adel Noureddine, Université de Pau et des Pays de l'Adour.
-- All rights reserved. This program and the accompanying materials
-- are made available under the terms of the
-- GNU General Public License v3.0 only (GPL-3.0-only)
Expand Down
Loading

0 comments on commit 509d181

Please sign in to comment.