bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / rubbos_scripts / 1-1-1 / rubbos_conf / cpu_mem.sh
1 #!/bin/bash
2
3 cd /bottlenecks/rubbos/rubbos_scripts/1-1-1
4 source set_bottlenecks_rubbos_env.sh
5 cd -
6
7 # delay inbetween snapshots
8
9 delay=1
10
11 # central host to send results to
12 analysis_host=$BENCHMARK_HOST
13
14 # monitoring start/end time in format YYYYmmddHHMMSS (20050920152059)
15 start_time=$1
16 end_time=$2
17
18 # data filename suffix
19 data_filename_suffix="`hostname`-${start_time}.data"
20
21 # sar filename
22 sar_filename=$RUBBOS_APP/sar-${data_filename_suffix}
23
24 # iostat filename
25 iostat_filename=$RUBBOS_APP/iostat-${data_filename_suffix}
26
27 # ps filename
28 ps_filename=$RUBBOS_APP/ps-${data_filename_suffix}
29
30 # date command in predefined format
31 date_cmd="date +%Y%m%d%H%M%S"
32 date=`$date_cmd`
33
34 # TEST MODE: start_time will be 2 seconds from launch, end time 5 seconds
35 #start_time=`expr $date \+ 2`
36 #end_time=`expr $date \+ 5`
37
38 #echo
39 #echo Current timestamp:  $date
40 #echo Start timestamp:  $start_time
41 #echo End timestamp:  $end_time
42 #echo
43
44 # make sure they have all arguments
45 if [ "$end_time" = "" ]; then
46   echo usage: $0 \<delay\> \<analysis host\> \<start time\> \<end time\>
47   echo start_time and end_time are in YYYYmmddHHMMSS format
48   echo ie: 9/30/2005, 2:31:54pm = 20050930143154
49   echo
50   exit
51 fi
52
53 # wait until start time
54 #echo -n Waiting until start time \(${start_time}\)..
55 date=`$date_cmd`
56 while [ $date -lt $start_time ]; do
57   sleep 1
58   date=`$date_cmd`
59 done
60 #echo
61
62
63 # launch iostat
64 sudo nice -n -1 $SYSSTAT_HOME/bin/iostat -dxtk $delay > ${iostat_filename} &
65 iostat_pid=$!
66
67
68 # run test until end time
69 #echo -n Running test until end time \(${end_time}\)..
70 while [ $date -lt $end_time ]; do
71
72   sleep $delay
73   date=`$date_cmd`
74 done
75 #echo
76
77
78 # kill iostat
79 sudo kill -9 $iostat_pid
80
81
82 # chmod
83
84 sudo chmod g+w ${iostat_filename}
85 sudo chmod o+r ${iostat_filename}
86
87
88 # send data to analysis host
89 #echo Sending data to analysis host.. 
90 #scp -o StrictHostKeyChecking=no -o BatchMode=yes ${sar_filename} ${analysis_host}:/tmp/elba/rubbos
91 #scp -o StrictHostKeyChecking=no -o BatchMode=yes ${ps_filename} ${analysis_host}:/tmp/elba/rubbos
92