summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/TAO/MT_Cubit/MT_Cubit_Test
blob: dd08914f44bc2ee8aedf16aa306decfd424296f4 (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
#! /bin/sh
# $Id$
#
# Spawns MT_Cubit server and client executables on a single host.

usage="usage: $0 [-n <iterations>] [-r <host>] [-t] [-l] <# low priority threads>"
usage2="    [-l] suppresses use of -ORBiioplite, [-r runs client on <host>], [-t] uses /tmp"

user=`whoami`
ior_file=/tmp/MT_Cubit-ior.${user}
iterations=1000
client_exec_prefix=time
iiop_lite=-ORBiioplite
remote_host=

if [ "$HOSTTYPE" = "lynxos" ]; then
  server_exec_prefix='prio 30'
  tmp='/tmp/'
else
  server_exec_prefix=
  tmp=
fi

if [ ! "$PWD" ]; then
  PWD=`pwd`
fi

########
######## Interpret command arguments.
########
while getopts ?ln:r:t arg; do
  case $arg in
      l   ) iiop_lite= ;;
      n   ) iterations=$OPTARG ;;
      r   ) remote_host=$OPTARG
            ior_file=MT_Cubit-ior ;;
      t   ) tmp='/tmp/' ;;
      '?' ) echo $usage; echo $usage2; exit 0 ;;
  esac
done
shift `expr $OPTIND - 1`

if [ $# -ne 1 ]; then
  echo $usage; echo $usage2
  exit 1
fi
threads=`expr $1 + 1`


########
######## Enable signal handler.
########
trap 'kill -15 $server_pid; /bin/rm -f $ior_file' 0 1 2 15


########
######## Start server and save its pid.
########
$server_exec_prefix ./server -f $ior_file -t $threads $iiop_lite > \
  ${tmp}server.log 2>&1 &
server_pid=$!

while [ ! -f $ior_file ]; do
  sleep 2
done


########
######## Start client.
########
if [ "$remote_host" ]; then
  rsh $remote_host \
    "cd $PWD; LD_LIBRARY_PATH=$LD_LIBRARY_PATH $client_exec_prefix \
    ./client -f $ior_file -t $threads -n $iterations $iiop_lite" > \
    ${tmp}client-${threads}.log 2>&1
else
  $client_exec_prefix \
    ./client -f $ior_file -t $threads -n $iterations $iiop_lite  > \
    ${tmp}client-${threads}.log 2>&1
fi