ldap: Add ldap lookup benchmark
[kai/ad-bench.git] / time_kinit.sh
1 #!/bin/bash
2
3 # Iterations are set per test, so more time-consuming tests can be run less
4 # often
5 ITERATIONS=100
6
7 source `dirname $0`/utils.sh
8
9 set_up () {
10         set_krb_env
11         setup_kinit
12 }
13
14 tear_down () {
15         restore_krb_env
16 }
17
18 set_up
19
20 PRINCIPAL=$( get_principal $1)
21 PASSWORD=$( get_password $1)
22
23 echo -e "\tKINIT ${PRINCIPAL}"
24
25 START_TIME=$( start_timer )
26
27 echo -en "\t"
28 for i in $(${SEQ} 1 $ITERATIONS); do
29         call_kinit "${PRINCIPAL}" "${PASSWORD}"
30         ${KDESTROY}
31         echo -n "."
32 done
33 echo "done"
34
35 STOP_TIME=$( stop_timer )
36
37 TOTAL_TIME=$( total_time $START_TIME $STOP_TIME )
38
39 echo -e "\t\ttotal time:\t\t${TOTAL_TIME}s"
40
41 LOGINS_PER_MINUTE=$(iterations_per_minute $START_TIME $STOP_TIME $ITERATIONS)
42
43 echo -e "\t\titerations/min:\t\t$LOGINS_PER_MINUTE"
44
45 tear_down
46