last bug fixes and test2 & test3
This commit is contained in:
55
scripts/statistiche.sh
Executable file
55
scripts/statistiche.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
LOGFILE="logs/l.log"
|
||||
|
||||
READS=$(awk 'BEGIN{cnt=0} /readFile.*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
READSMEANB=$(awk 'BEGIN{cnt=0; tot=0} /readFile.*successo/{where = match($0, /dimensione = ([0-9]+)/, arr); if(where != 0) {++cnt; tot+=strtonum(arr[1])}} END{if(cnt!=0){print tot/cnt} else {print 0}}' $LOGFILE)
|
||||
|
||||
NREADS=$(awk 'BEGIN{cnt=0} /readNFile.*successo/{++cnt} END {print cnt}' $LOGFILE)
|
||||
NREADSMEANN=$(awk 'BEGIN{cnt=0; tot=0} /readNFile.*successo/{where = match($0, /\(n = ([0-9]+)\)/, arr); if(where != 0) {++cnt; tot+=strtonum(arr[1])}} END{if(cnt!=0) {print tot/cnt} else {print 0}}' $LOGFILE)
|
||||
NREADSMEANB=$(awk 'BEGIN{cnt=0; tot=0} /readNFile/{where = match($0, /totale = ([0-9]+)/, arr); if(where != 0) {++cnt; tot+=strtonum(arr[1])}} END{if(cnt!=0) {print tot/cnt} else {print 0}}' $LOGFILE)
|
||||
|
||||
LETTURA=$(echo $READS + $NREADS | bc -l)
|
||||
|
||||
|
||||
WRITES=$(awk 'BEGIN{cnt=0} /writeFile.*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
WRITESMEANB=$(awk 'BEGIN{cnt=0; tot=0} /writeFile.*successo/{where = match($0, /dimensione = ([0-9]+)/, arr); if(where != 0) {++cnt; tot+=strtonum(arr[1])}} END{if(cnt!=0){print tot/cnt} else {print 0}}' $LOGFILE)
|
||||
|
||||
|
||||
LOCKS=$(awk 'BEGIN{cnt=0} /lockFile.*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
OPENLOCKS=$(awk 'BEGIN{cnt=0} /openFile.*flags = [23].*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
UNLOCKS=$(awk 'BEGIN{cnt=0} /unlockFile.*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
CLOSES=$(awk 'BEGIN{cnt=0} /closeFile.*successo/{++cnt} END{print cnt}' $LOGFILE)
|
||||
|
||||
|
||||
NTHREADS=$(awk 'BEGIN{n=0} /Creato threadpool.*/{where = match($0, /dimensione ([0-9]+)/, arr); if(where != 0) {n=strtonum(arr[1])}} END{print n}' $LOGFILE)
|
||||
T=()
|
||||
for ((i=0;i<$NTHREADS;i++)); do
|
||||
T[$i]=$(awk -v i=$i 'BEGIN{cnt=0; pat="Thread "i".*ha servito una richiesta"} $0 ~ pat{++cnt} END{print cnt}' $LOGFILE)
|
||||
done
|
||||
|
||||
MAXNFILES=$(awk 'BEGIN{n=0} /Numero di file massimo.*/{where = match($0, /: ([0-9]+)/, arr); if(where != 0) {n=strtonum(arr[1])}} END{print n}' $LOGFILE)
|
||||
MAXBFILES=$(awk 'BEGIN{n=0} /Dimensione massima.*/{where = match($0, /: ([0-9.]+)/, arr); if(where != 0) {n=strtonum(arr[1])}} END{print n}' $LOGFILE)
|
||||
MAXVITTIMS=$(awk 'BEGIN{n=0} /vittima.*/{where = match($0, /: ([0-9.]+)/, arr); if(where != 0) {n=strtonum(arr[1])}} END{print n}' $LOGFILE)
|
||||
|
||||
MAXCLIENTS=$(awk 'BEGIN{max=0; cur=0} {where = match($0, /Nuovo client.*/); if(where != 0) {++cur; max = (max<cur)?cur:max}; where = match($0, /Chiusa connessione.*/); if(where != 0) {--cur}} END{print max}' $LOGFILE)
|
||||
|
||||
echo "Operazioni di read: $READS (dimensione media: $READSMEANB)"
|
||||
echo "Operazioni di readN: $NREADS (numero medio: $NREADSMEANN, dimensione media: $NREADSMEANB)"
|
||||
echo "Operazioni totali di lettura: $LETTURA"
|
||||
|
||||
echo "Operazioni di write: $WRITES (dimensione media: $WRITESMEANB)"
|
||||
|
||||
echo "Operazioni di lock: $LOCKS"
|
||||
echo "Operazioni di openlock: $OPENLOCKS"
|
||||
echo "Operazioni di unlock: $UNLOCKS"
|
||||
echo "Operazioni di close: $CLOSES"
|
||||
|
||||
for ((i=0;i<$NTHREADS;i++)); do
|
||||
echo "Richieste servite dal worker thread $i: ${T[$i]}"
|
||||
done
|
||||
|
||||
echo "Numero massimo di file: $MAXNFILES"
|
||||
echo "Dimensione massima dei file: $MAXBFILES MB"
|
||||
echo "Numero di volte in cui l’algoritmo di rimpiazzamento della cache è stato eseguito per selezionare un file vittima: $MAXVITTIMS"
|
||||
echo "Massimo numero di connessioni contemporanee: $MAXCLIENTS"
|
||||
0
scripts/test1.sh
Normal file → Executable file
0
scripts/test1.sh
Normal file → Executable file
10
scripts/test2.sh
Normal file → Executable file
10
scripts/test2.sh
Normal file → Executable file
@ -1,10 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
./build/client -t 200 -f socket -w testFiles/1 -l testFiles/1/file1 -W testFiles/6/f1 -D build/Wdir -r testFiles/1/file1 -R n=3 -d build/Rdir -u testFiles/1/file1 -p &
|
||||
./build/client -t 200 -f socket -w testFiles/2 -W testFiles/6/f2 -D build/Wdir -l testFiles/1/file1 -r testFiles/2/file6 -R n=3 -d build/Rdir -u testFiles/1/file1 -p &
|
||||
./build/client -t 200 -f socket -w testFiles/3 -W testFiles/6/f3 -D build/Wdir -r testFiles/3/file11 -R n=3 -d build/Rdir -l testFiles/3/file11 -c testFiles/3/file11 -p &
|
||||
./build/client -t 200 -f socket -w testFiles/4 -W testFiles/6/f4 -D build/Wdir -r testFiles/4/file16 -R n=3 -d build/Rdir -l testFiles/3/file12 -c testFiles/3/file12 -p &
|
||||
./build/client -t 200 -f socket -w testFiles/5 -W testFiles/6/f5 -D build/Wdir -r testFiles/5/file21 -R n=3 -d build/Rdir -l testFiles/3/file13 -c testFiles/3/file13 -p &
|
||||
./build/client -t 200 -f socket -w testFiles/1 -D build/Wdir -l testFiles/1/file5 -r testFiles/1/file5 -R n=3 -d build/Rdir -u testFiles/1/file5 -p > ./logs/client1.log &
|
||||
./build/client -t 200 -f socket -w testFiles/2 -D build/Wdir -r testFiles/2/file10 -R n=3 -d build/Rdir -p > ./logs/client2.log &
|
||||
./build/client -t 200 -f socket -w testFiles/3 -D build/Wdir -r testFiles/3/file15 -R n=3 -d build/Rdir -p > ./logs/client3.log &
|
||||
./build/client -t 200 -f socket -w testFiles/4 -D build/Wdir -r testFiles/4/file20 -R n=3 -d build/Rdir -p > ./logs/client4.log &
|
||||
./build/client -t 200 -f socket -w testFiles/5 -D build/Wdir -r testFiles/5/file25 -R n=3 -d build/Rdir -p > ./logs/client5.log &
|
||||
wait
|
||||
|
||||
exit 0
|
||||
|
||||
18
scripts/test3.sh
Executable file
18
scripts/test3.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
for ((i = 0; i <= 30; i++)); do
|
||||
./build/client -t 0 -f socket -w testFiles/1 -W testFiles/6/f1 -D build/Wdir -r testFiles/1/file1 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/2 -W testFiles/6/f2 -D build/Wdir -r testFiles/2/file6 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/3 -W testFiles/6/f3 -D build/Wdir -r testFiles/3/file11 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/4 -W testFiles/6/f4 -D build/Wdir -r testFiles/4/file16 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/5 -W testFiles/6/f5 -D build/Wdir -r testFiles/5/file21 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/1 -W testFiles/6/f1 -D build/Wdir -r testFiles/1/file2 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/2 -W testFiles/6/f2 -D build/Wdir -r testFiles/2/file7 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/3 -W testFiles/6/f3 -D build/Wdir -r testFiles/3/file12 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/4 -W testFiles/6/f4 -D build/Wdir -r testFiles/4/file17 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/5 -W testFiles/6/f5 -D build/Wdir -r testFiles/5/file22 -R n=5 -d build/Rdir &
|
||||
./build/client -t 0 -f socket -w testFiles/6 -r testFiles/1/file1 -R n=5 -d build/Rdir &
|
||||
sleep 1
|
||||
done
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user