-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompil.sh
executable file
·168 lines (141 loc) · 3.58 KB
/
compil.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
lib="lib/CryptoPP";
if [ $# -eq 1 ]
then
if [ $1 == "clean" ]
then
if [ -e ${lib} ]
then
rm -R ${lib};
fi
if [ -e build ]
then
rm -R build/;
fi
if [ -e info ]
then
rm -R info/;
fi
if [ -e cpuinfo.txt ]
then
rm cpuinfo.txt;
fi
if [ -e meminfo.txt ]
then
rm meminfo.txt;
fi
if [ -e cacheinfo.txt ]
then
rm cacheinfo.txt;
fi
fi
else
echo "Recherche de la librarie...";
if [ -e "${lib}/libcryptopp.a" ]
then
echo "Librairie deja compilee";
else
echo "Extraction de la librairie...";
mkdir ${lib};
unzip lib/cryptopp820.zip -d ${lib};
echo "Fin de l'extraction";
echo "Compilation de la librairie";
cd ${lib};
make;
rm *.o;
rm *.exe;
cd ../..;
echo "Librairie compilee";
fi
echo "Compilation du programme";
if [ ! -e "build" ]
then
mkdir build;
fi
g++ -DNDEBUG -g2 -O2 -I ${lib} src/sequentiel.cpp -o build/sequentiel.exe ${lib}/libcryptopp.a;
echo "Compilation sequentiel.cpp reussie";
g++ -DNDEBUG -g2 -O2 -I ${lib} src/multiThread.cpp -o build/multiThread.exe ${lib}/libcryptopp.a -lpthread;
echo "Compilation multiThread.cpp reussie";
echo;
echo "Execution des tests de temps";
echo "Mot: za" > temps.log;
echo "=========" >> temps.log;
./build/sequentiel.exe za >> temps.log;
./build/multiThread.exe 2 za >> temps.log;
./build/multiThread.exe 4 za >> temps.log;
./build/multiThread.exe 8 za >> temps.log;
./build/multiThread.exe 26 za >> temps.log;
echo " Mot de 2 caracteres";
echo >> temps.log;
echo "Mot: zza" >> temps.log;
echo "=========" >> temps.log;
./build/sequentiel.exe zza >> temps.log;
./build/multiThread.exe 2 zza >> temps.log;
./build/multiThread.exe 4 zza >> temps.log;
./build/multiThread.exe 8 zza >> temps.log;
./build/multiThread.exe 26 zza >> temps.log;
echo " Mot de 3 caracteres";
echo >> temps.log;
echo "Mot: zzza" >> temps.log;
echo "=========" >> temps.log;
./build/sequentiel.exe zzza >> temps.log;
./build/multiThread.exe 2 zzza >> temps.log;
./build/multiThread.exe 4 zzza >> temps.log;
./build/multiThread.exe 8 zzza >> temps.log;
./build/multiThread.exe 26 zzza >> temps.log;
echo " Mot de 4 caracteres";
echo >> temps.log;
echo "Mot: zzzza" >> temps.log;
echo "=========" >> temps.log;
./build/sequentiel.exe zzzza >> temps.log;
./build/multiThread.exe 2 zzzza >> temps.log;
./build/multiThread.exe 4 zzzza >> temps.log;
./build/multiThread.exe 8 zzzza >> temps.log;
./build/multiThread.exe 26 zzzza >> temps.log;
echo " Mot de 5 caracteres";
echo >> temps.log;
echo "Mot: zzzzza" >> temps.log;
echo "=========" >> temps.log;
./build/sequentiel.exe zzzzza >> temps.log;
./build/multiThread.exe 2 zzzzza >> temps.log;
./build/multiThread.exe 4 zzzzza >> temps.log;
./build/multiThread.exe 8 zzzzza >> temps.log;
./build/multiThread.exe 26 zzzzza >> temps.log;
echo " Mot de 6 caracteres";
echo;
echo "Informations du cpu et memoire dans les fichiers:";
echo " info/cpuinfo.txt";
echo " info/meminfo.txt";
echo " info/cacheinfo.txt";
if [ ! -e "info" ]
then
mkdir info;
fi
cat /proc/cpuinfo > info/cpuinfo.txt;
cat /proc/meminfo > info/meminfo.txt;
sudo lshw -C memory > info/cacheinfo.txt;
fi
#
#Verifier le nombre d'arguments
#Si 0 arg
#Si libcryptopp.a existe
#Afficher que la librairie existe et est compilee
#Sinon
#Demande d'extraire la librairie
#Si Oui
#Extraire
#FinSi
#Demande de compilee la librairie
#Si Oui
#Compiler
#FinSi
#FinSI
#Compiler le programme
#Sinon si 1 arg
#Si arg = clean
#Demande d'accepter
#Si Oui
#Supprimer la librairie extraite et compilee
#FinSi
#FinSi
#FinSi