-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexec_vm_scenriaos.sh
executable file
·94 lines (81 loc) · 1.99 KB
/
exec_vm_scenriaos.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
#!/bin/bash
#chieck if fio is installed
function_check_rally_dir()
{
echo `ls /tmp`|grep rally_scalability >> /tmp/tmp.log
if [ $? -ne 0 ]
then
mkdir rally_scalability
fi
}
check_fio()
{
fio|grep apt
if [$? -eq 0 ]
then
echo dpkg -i xxx.deb
fi
}
function_dd_fio()
{
mkdir –p /test
rm /test/result.log
date
#urandom 函数会密集调用cpu资源,生存的随机内容写入hello文件,大小100M左右
time dd if=/dev/urandom of=/test/hello bs=10M count=10 oflag=direct
echo urandom
time dd of=/dev/null if=/test/hello bs=10M count=10 iflag=direct
echo null
fio --filename=/test/hello --direct=1 --rw=randwrite --bs=4k --size=10M --numjobs=10 --runtime=20 --name=file1 --ioengine=aio --iodepth=32 --group_reporting
echo randwrite 4k
fio --filename=/test/hello --direct=1 --rw=randread --bs=4k --size=10M --numjobs=10 --runtime=20 --name=file1 --ioengine=aio --iodepth=32 --group_reporting
echo randread 4k
}
function_compute()
{
multiplier1=`echo $RANDOM`
multiplier2=`echo $RANDOM`
echo $multiplier1
echo $multiplier2
let "product=$multiplier1 * $multiplier2"
# echo $produc
echo $multiplier1 x $multiplier2 = $product tag_simth >> /tmp/rally_scalability/test.txt
}
#function_storage()
#{
#}
#function_network()
#{
#}
function_check_ifprime()
{
current_date=`date "+%Y_%m_%d_%H_%M_%S"`
echo current_date is: $current_date
final_number=`tail -1 /tmp/rally_scalability/test.txt|awk '{print $5}'`
if [ -z $final_number ];then
echo Usage:$0 num
exit 0
fi
for (( i=2; i<=$final_number;i++ ));do
flag=0;
for (( j=2;j<=i/2;j++ )); do
if ((i%j==0));then
flag=1;
echo == $i $j
break;
fi
done
done
if (($flag));then
echo $N is not a prime number;
else
echo $N is a prime number;
fi
end_date=`date "+%Y_%m_%d_%H_%M_%S"`
echo end_date is: $end_date
}
cd /tmp
#function_check_rally_dir
#function_compute
#function_check_ifprime
function_dd_fio