Skip to content

Commit

Permalink
Support all revisions of Raspberry Pi models
Browse files Browse the repository at this point in the history
  • Loading branch information
adelnoureddine committed Oct 20, 2023
1 parent e423a9f commit 528687e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 1 deletion.
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.6.2"
version = "0.7.0"

authors = ["Adel Noureddine"]
maintainers = ["Adel Noureddine <[email protected]>"]
Expand Down
75 changes: 75 additions & 0 deletions src/os_utils.adb
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ package body OS_Utils is
while not End_Of_File (F_Name) loop
Line_String := To_Unbounded_String (Get_Line (F_Name));

-- Specific model used to train the energy models

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

-- Raspberry Pi 4B 1.2
Index_Search := Index (To_String (Line_String), "Raspberry Pi 4 Model B Rev 1.2");
if (Index_Search > 0) then
if (Architecture_Name = "aarch64") then
Expand All @@ -82,6 +86,7 @@ package body OS_Utils is
end if;
end if;

-- Raspberry Pi 4B 1.1
Index_Search := Index (To_String (Line_String), "Raspberry Pi 4 Model B Rev 1.1");
if (Index_Search > 0) then
if (Architecture_Name = "aarch64") then
Expand All @@ -91,40 +96,110 @@ package body OS_Utils is
end if;
end if;

-- Raspberry Pi 3B+ 1.3
Index_Search := Index (To_String (Line_String), "Raspberry Pi 3 Model B Plus Rev 1.3");
if (Index_Search > 0) then
return "rbp3b+1.3";
end if;

-- Raspberry Pi 3B 1.2
Index_Search := Index (To_String (Line_String), "Raspberry Pi 3 Model B Rev 1.2");
if (Index_Search > 0) then
return "rbp3b1.2";
end if;

-- Raspberry Pi 2B 1.1
Index_Search := Index (To_String (Line_String), "Raspberry Pi 2 Model B Rev 1.1");
if (Index_Search > 0) then
return "rbp2b1.1";
end if;

-- Raspberry Pi B+ 1.2
Index_Search := Index (To_String (Line_String), "Raspberry Pi Model B Plus Rev 1.2");
if (Index_Search > 0) then
return "rbp1b+1.2";
end if;

-- Raspberry Pi B 2
Index_Search := Index (To_String (Line_String), "Raspberry Pi Model B Rev 2");
if (Index_Search > 0) then
return "rbp1b2";
end if;

-- Raspberry Pi Zero W 1.1
Index_Search := Index (To_String (Line_String), "Raspberry Pi Zero W Rev 1.1");
if (Index_Search > 0) then
return "rbpzw1.1";
end if;

-- Asus Tinker Board (S)
Index_Search := Index (To_String (Line_String), "ASUS Tinker Board (S)");
if (Index_Search > 0) then
return "asustbs";
end if;

-- 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 400
Index_Search := Index (To_String (Line_String), "Raspberry Pi 400");
if (Index_Search > 0) then
if (Architecture_Name = "aarch64") then
return "rbp4001.0-64";
end if;
end if;

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

-- Raspberry Pi 3B+
Index_Search := Index (To_String (Line_String), "Raspberry Pi 3 Model B Plus");
if (Index_Search > 0) then
return "rbp3b+1.3";
end if;

-- Raspberry Pi 3B
Index_Search := Index (To_String (Line_String), "Raspberry Pi 3 Model B");
if (Index_Search > 0) then
return "rbp3b1.2";
end if;

-- Raspberry Pi 2B
Index_Search := Index (To_String (Line_String), "Raspberry Pi 2 Model B");
if (Index_Search > 0) then
return "rbp2b1.1";
end if;

-- Raspberry Pi B+
Index_Search := Index (To_String (Line_String), "Raspberry Pi Model B Plus");
if (Index_Search > 0) then
return "rbp1b+1.2";
end if;

-- Raspberry Pi B
Index_Search := Index (To_String (Line_String), "Raspberry Pi Model B");
if (Index_Search > 0) then
return "rbp1b2";
end if;

-- Raspberry Pi Zero W
Index_Search := Index (To_String (Line_String), "Raspberry Pi Zero W");
if (Index_Search > 0) then
return "rbpzw1.1";
end if;

-- Asus Tinker Board
Index_Search := Index (To_String (Line_String), "ASUS Tinker Board");
if (Index_Search > 0) then
return "asustbs";
end if;
end loop;

Close (F_Name);
Expand Down

0 comments on commit 528687e

Please sign in to comment.