summaryrefslogtreecommitdiffstats
path: root/rubbos/rubbos_scripts/1-1-1/rubbos_conf/cpu_mem.sh
blob: ecaa7eb136afd69f558ef4dca88b8597a324ba12 (plain)
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
#!/bin/bash

cd /bottlenecks/rubbos/rubbos_scripts/1-1-1
source set_bottlenecks_rubbos_env.sh
cd -

# delay inbetween snapshots

delay=1

# central host to send results to
analysis_host=$BENCHMARK_HOST

# monitoring start/end time in format YYYYmmddHHMMSS (20050920152059)
start_time=$1
end_time=$2

# data filename suffix
data_filename_suffix="`hostname`-${start_time}.data"

# sar filename
sar_filename=$RUBBOS_APP/sar-${data_filename_suffix}

# iostat filename
iostat_filename=$RUBBOS_APP/iostat-${data_filename_suffix}

# ps filename
ps_filename=$RUBBOS_APP/ps-${data_filename_suffix}

# date command in predefined format
date_cmd="date +%Y%m%d%H%M%S"
date=`$date_cmd`

# TEST MODE: start_time will be 2 seconds from launch, end time 5 seconds
#start_time=`expr $date \+ 2`
#end_time=`expr $date \+ 5`

#echo
#echo Current timestamp:  $date
#echo Start timestamp:  $start_time
#echo End timestamp:  $end_time
#echo

# make sure they have all arguments
if [ "$end_time" = "" ]; then
  echo usage: $0 \<delay\> \<analysis host\> \<start time\> \<end time\>
  echo start_time and end_time are in YYYYmmddHHMMSS format
  echo ie: 9/30/2005, 2:31:54pm = 20050930143154
  echo
  exit
fi

# wait until start time
#echo -n Waiting until start time \(${start_time}\)..
date=`$date_cmd`
while [ $date -lt $start_time ]; do
  sleep 1
  date=`$date_cmd`
done
#echo


# launch iostat
sudo nice -n -1 $SYSSTAT_HOME/bin/iostat -dxtk $delay > ${iostat_filename} &
iostat_pid=$!


# run test until end time
#echo -n Running test until end time \(${end_time}\)..
while [ $date -lt $end_time ]; do

  sleep $delay
  date=`$date_cmd`
done
#echo


# kill iostat
sudo kill -9 $iostat_pid


# chmod

sudo chmod g+w ${iostat_filename}
sudo chmod o+r ${iostat_filename}


# send data to analysis host
#echo Sending data to analysis host.. 
#scp -o StrictHostKeyChecking=no -o BatchMode=yes ${sar_filename} ${analysis_host}:/tmp/elba/rubbos
#scp -o StrictHostKeyChecking=no -o BatchMode=yes ${ps_filename} ${analysis_host}:/tmp/elba/rubbos