forked from greensoftwarelab/Energy-Languages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
measure.sh
70 lines (60 loc) · 1.77 KB
/
measure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
NTIMES=20
#This code was tested on Linux Ubuntu Server 22.04.3 LTS
#Compile sensors wich will be used to calculate cool temperature
cd RAPL
gcc -shared -o sensors.so sensors.c
cd ..
#Update the temperature value
cd Utils/
python3 temperatureUpdate.py
#Update the number of times the program will run on each case TODO PRECISO ATUALIZAR ISTO PARA TODOS OS PROGRAMAS
for language in "../Languages"/*; do
for program in "$language"/*; do
if [ -d "$program" ]; then
makefile_path="$program/Makefile"
if [ -f "$makefile_path" ]; then
python3 ntimesUpdate.py "$NTIMES" "$makefile_path"
else
echo "Makefile not found: $makefile_path"
fi
fi
done
done
cd ..
echo "Language,Program,PowerLimit,Package,Core,GPU,DRAM,Time,Temperature,Memory" > measurements.csv
# Loop over power limit values
for limit in -1 2 10 15 25
do
cd Utils/
python3 raplCapUpdate.py $limit ../RAPL/main.c
cd ..
#Make RAPL lib
cd RAPL/
rm sensors.so
make
cd ..
for language in "Languages"/*; do
for program in "$language"/*; do
if [ -d "$program" ]; then
makefile_path="$program/Makefile"
if [ -f "$makefile_path" ]; then
cd $program
make compile
make measure
# Specify the input file name
file="measurements.csv"
tail -n +2 "$file" >> ../../../measurements.csv;
make clean
cd ../../..
else
echo "Makefile not found: $makefile_path"
fi
fi
done
done
done
cd RAPL/
make clean
cd ..
sudo reboot