Skip to content

Commit

Permalink
Add support for Raspberry Pi 5B
Browse files Browse the repository at this point in the history
  • Loading branch information
adelnoureddine committed Jan 8, 2024
1 parent 5c499fe commit d2ed059
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/os_utils.adb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package body OS_Utils is
-- Check if platform supports Raspberry Pi
function Check_Raspberry_Pi_Supported_System (Platform_Name : in String) return Boolean is
begin
return Platform_Name in "rbp4001.0-64" | "rbp4b1.2" | "rbp4b1.2-64" | "rbp4b1.1" | "rbp4b1.1-64" | "rbp3b+1.3" | "rbp3b1.2" | "rbp2b1.1" | "rbp1b+1.2" | "rbp1b2" | "rbpzw1.1" | "asustbs";
return Platform_Name in "rbp5b1.0-64" | "rbp4001.0-64" | "rbp4b1.2" | "rbp4b1.2-64" | "rbp4b1.1" | "rbp4b1.1-64" | "rbp3b+1.3" | "rbp3b1.2" | "rbp2b1.1" | "rbp1b+1.2" | "rbp1b2" | "rbpzw1.1" | "asustbs";
end;

-- Get architecture name (uname -m)
Expand Down Expand Up @@ -67,6 +67,14 @@ package body OS_Utils is
Line_String := To_Unbounded_String (Get_Line (F_Name));

-- Specific model used to train the energy models

-- Raspberry Pi 5B 1.0
Index_Search := Index (To_String (Line_String), "Raspberry Pi 5 Model B Rev 1.0");
if (Index_Search > 0) then
if (Architecture_Name = "aarch64") then
return "rbp5b1.0-64";
end if;
end if;

-- Raspberry Pi 400 1.0
Index_Search := Index (To_String (Line_String), "Raspberry Pi 400 Rev 1.0");
Expand Down Expand Up @@ -140,6 +148,14 @@ package body OS_Utils is

-- Supporting other revisions where specific energy models were not generated
-- In this case, we use the model of the same RPi model but different revision

-- Raspberry Pi 5B
Index_Search := Index (To_String (Line_String), "Raspberry Pi 5 Model B");
if (Index_Search > 0) then
if (Architecture_Name = "aarch64") then
return "rbp5b1.0-64";
end if;
end if;

-- Raspberry Pi 400
Index_Search := Index (To_String (Line_String), "Raspberry Pi 400");
Expand Down
18 changes: 18 additions & 0 deletions src/raspberry_pi_cpu_formula.adb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ package body Raspberry_Pi_CPU_Formula is
begin
-- Formulas are based on empirical experimentation and linear/polynomial regression

if (Platform_Name = "rbp51.0-64") then
if (Algorithm_Name = "linear") then
return (3.457855981342954 * CPU_Utilization) + 4.403192179893827;
elsif (Algorithm_Name = "polynomial") then
return 8.71648242592654 + (-186.5634686 * (CPU_Utilization ** 1)) +
(2676.08397456 * (CPU_Utilization ** 2)) +
(-18839.18873015 * (CPU_Utilization ** 3)) +
(75110.3949109 * (CPU_Utilization ** 4)) +
(-180373.73562042 * (CPU_Utilization ** 5)) +
(267380.23597063 * (CPU_Utilization ** 6)) +
(-240403.81341249 * (CPU_Utilization ** 7)) +
(120509.01405772 * (CPU_Utilization ** 8)) +
(-25877.41360901 * (CPU_Utilization ** 9));
else
return 0.0;
end if;
end if;

if (Platform_Name = "rbp4001.0-64") then
if (Algorithm_Name = "linear") then
return (5.025368568347057 * CPU_Utilization) + 1.8221330203847232;
Expand Down

0 comments on commit d2ed059

Please sign in to comment.