-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfilesystem_benchmark.bash
60 lines (57 loc) · 1.28 KB
/
filesystem_benchmark.bash
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
if [ "$1" != "" ]; then
SRC_LOCATION=$1
else
SRC_LOCATION=/tmp/jeonb/TMP0
fi
if [ "$2" != "" ]; then
TARGET_LOCATION=$2
else
TARGET_LOCATION=/tmp/jeonb/TMP1
fi
echo 'SRC folder = ' $SRC_LOCATION
echo 'TARGET folder =' $TARGET_LOCATION
Nref=8
mkdir -p $SRC_LOCATION
mkdir -p $TARGET_LOCATION
for file in $SRC_LOCATION/*; do
rm $file
done
for file in $TARGET_LOCATION/*; do
rm $file
done
for N in `seq $Nref -1 2`
do
Nmod=N/3+1
Nfra=N%3
filesize=$((1024**Nmod*10**Nfra/10))
nfiles=$((10**(Nref-N)))
echo 'file size=' $filesize 'nfiles=' $nfiles
start_time=`date +%s`
# generating random files
for x in `seq 1 $nfiles`; do
head -c $filesize /dev/urandom > $SRC_LOCATION/file_$x
done
end_time=`date +%s`
echo $((end_time - start_time)) "sec for creating"
sync
sync
# Copying files
start_time=`date +%s`
for file in $SRC_LOCATION/*; do
cp $file $TARGET_LOCATION
done
end_time=`date +%s`
echo $((end_time - start_time)) "sec for copying"
sync
sync
# Deleting files
start_time=`date +%s`
for file in $SRC_LOCATION/*; do
rm $file
done
for file in $TARGET_LOCATION/*; do
rm $file
done
end_time=`date +%s`
echo $((end_time - start_time)) "sec for deleting"
done