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