1178515Srwatson#!/bin/sh
2330449Seadler#
3330449Seadler#
4178515Srwatson
5178515SrwatsonACCT=acct
6178515SrwatsonRESULTS=acct.`uname -m`.tar.gz
7178515SrwatsonTMPDIR=$$.tmp
8178515SrwatsonTZ=UTC; export TZ
9178515Srwatson
10178515Srwatsonrun()
11178515Srwatson{
12178515Srwatson	/usr/bin/time -l -o $1.time "$@"
13178515Srwatson}
14178515Srwatson
15178515Srwatsonif [ `whoami` != "root" ]; then
16178515Srwatson	echo "You need to be root to run this test."
17178515Srwatson	exit 1
18178515Srwatsonfi
19178515Srwatson
20178515Srwatsonecho Redirecting accounting.
21178515Srwatson
22178515Srwatsonmkdir $TMPDIR
23178515Srwatsoncd $TMPDIR
24178515Srwatson
25178515Srwatson:>$ACCT
26178515Srwatsonaccton $ACCT
27178515Srwatson
28178515Srwatsonecho Running commands. This should not take more than 30s.
29178515Srwatson
30178515Srwatson# User time
31178515Srwatsonrun awk 'BEGIN {for (i = 0; i < 1000000; i++) cos(.3)}' /dev/null
32178515Srwatsonrun egrep '(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\8\7\6\5\4\3\2\1' /usr/share/dict/words
33178515Srwatson
34178515Srwatson# System time
35178515Srwatsonrun find /usr/src -name xyzzy
36178515Srwatson
37178515Srwatson# Elapsed time
38178515Srwatsonrun sleep 3
39178515Srwatson
40178515Srwatson# IO
41178515Srwatsonrun dd if=/dev/zero bs=512 count=4096 of=zero 2>/dev/null
42178515Srwatson
43178515Srwatson# Memory
44178515Srwatsonrun diff /usr/share/dict/words /dev/null >/dev/null
45178515Srwatson
46178515Srwatson# AC_COMM_LEN - 1
47178515Srwatsonln /usr/bin/true 123456789012345
48178515Srwatsonrun ./123456789012345
49178515Srwatson
50178515Srwatson# AC_COMM_LEN
51178515Srwatsonln /usr/bin/true 1234567890123456
52178515Srwatsonrun ./1234567890123456
53178515Srwatson
54178515Srwatson# AC_COMM_LEN + 1
55178515Srwatsonln /usr/bin/true 12345678901234567
56178515Srwatsonrun ./12345678901234567
57178515Srwatson
58178515Srwatson# Flags: core, fork, signal
59178515Srwatsonecho 'main(){volatile int s; fork(); s = *(int *)0;}' >core.c
60178515Srwatsoncc -o core core.c
61178515Srwatsonecho Generating segmentation fault.
62178515Srwatson./core
63178515Srwatson
64178515Srwatsonecho Turning off redirected accounting.
65178515Srwatson
66178515Srwatsonaccton
67178515Srwatson
68178515Srwatsonecho Packing the results.
69178515Srwatson
70178515Srwatsonsa -u $ACCT >sa.u
71178515Srwatsonlastcomm -cesuS -f $ACCT >lastcomm.cesuS
72178515Srwatsontar -cf - acct sa.u lastcomm.cesuS *.time |
73178515Srwatsongzip -c |
74178515Srwatsonuuencode $RESULTS >../$RESULTS.uue
75178515Srwatson
76178515Srwatsonecho Cleaning up.
77178515Srwatsoncd ..
78178515Srwatsonrm -rf $TMPDIR
79178515Srwatson
80178515Srwatsonecho "Done!  Please send your reply, enclosing the file $RESULTS.uue"
81178515Srwatsonecho If your system runs with accounting enabled you probably need to run:
82178515Srwatsonecho accton /var/account/acct
83178515Srwatson