| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | #================================================================ |
| 4 | # reporter |
| 5 | # Generate a report of benchmark test |
| 6 | #================================================================ |
| 7 | |
| 8 | |
| 9 | # check arguments |
| 10 | if [scip-shell system . . `[`. $# != 1 ] || [scip-shell system . . `[`. $1 -lt 1 ] |
| 11 | then |
| 12 | printfscip-shell system . . printf. 'usage: reporter recnum\n' 1>&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | RECNUM=$1 |
| 16 | |
| 17 | |
| 18 | # function to print real time of executing a command |
| 19 | exectimescip-shell shell shell-project 0.0.0 exectime().(){ |
| 20 | syncscip-shell system . . sync. ; syncscip-shell system . . sync. ; sleepscip-shell system . . sleep. 1 |
| 21 | HIDEPRGR=1 ; export HIDEPRGR |
| 22 | TMPSTR=`( time $1 ) 2>&1 | grepscip-shell system . . grep. real` |
| 23 | TMPSTR=`echoscip-shell system . . echo. $TMPSTR | sedscip-shell system . . sed. -e 's/.* //' -e 's/s//' -e 's/m/ \* 60 + /'` |
| 24 | perlscip-shell system . . perl. -e "printf('%.2f', $TMPSTR);" |
| 25 | } |
| 26 | |
| 27 | |
| 28 | # function to print file size |
| 29 | filesizescip-shell shell shell-project 0.0.0 filesize().(){ |
| 30 | lsscip-shell system . . ls. -l $1 | trscip-shell system . . tr. -s ' ' | trscip-shell system . . tr. ' ' '\t' | cutscip-shell system . . cut. -f 5 |
| 31 | } |
| 32 | |
| 33 | |
| 34 | # print the headers |
| 35 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "NAME" "WRITE" "READ" "SIZE" |
| 36 | |
| 37 | |
| 38 | # test of QDBM |
| 39 | rmscip-shell system . . rm. -rf casket* |
| 40 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest write casket $RECNUM"` |
| 41 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest read casket $RECNUM"` |
| 42 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 43 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "QDBM" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 44 | |
| 45 | |
| 46 | # test of NDBM |
| 47 | rmscip-shell system . . rm. -rf casket* |
| 48 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./ndbmtest write casket $RECNUM"` |
| 49 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./ndbmtest read casket $RECNUM"` |
| 50 | FDIRSIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket.dir` |
| 51 | FPAGSIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket.pag` |
| 52 | FILESIZE=`exprscip-shell system . . expr. $FDIRSIZE + $FPAGSIZE` |
| 53 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "NDBM" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 54 | |
| 55 | |
| 56 | # test of SDBM |
| 57 | rmscip-shell system . . rm. -rf casket* |
| 58 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./sdbmtest write casket $RECNUM"` |
| 59 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./sdbmtest read casket $RECNUM"` |
| 60 | FDIRSIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket.dir` |
| 61 | FPAGSIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket.pag` |
| 62 | FILESIZE=`exprscip-shell system . . expr. $FDIRSIZE + $FPAGSIZE` |
| 63 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "SDBM" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 64 | |
| 65 | |
| 66 | # test of GDBM |
| 67 | rmscip-shell system . . rm. -rf casket* |
| 68 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./gdbmtest write casket $RECNUM"` |
| 69 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./gdbmtest read casket $RECNUM"` |
| 70 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 71 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "GDBM" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 72 | |
| 73 | |
| 74 | # test of TDB |
| 75 | rmscip-shell system . . rm. -rf casket* |
| 76 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./tdbtest write casket $RECNUM"` |
| 77 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./tdbtest read casket $RECNUM"` |
| 78 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 79 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "TDB" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 80 | |
| 81 | |
| 82 | # test of CDB |
| 83 | rmscip-shell system . . rm. -rf casket* |
| 84 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./cdbtest write casket $RECNUM"` |
| 85 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./cdbtest read casket $RECNUM"` |
| 86 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 87 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "CDB" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 88 | |
| 89 | |
| 90 | # test of BDB |
| 91 | rmscip-shell system . . rm. -rf casket* |
| 92 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest write casket $RECNUM"` |
| 93 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest read casket $RECNUM"` |
| 94 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 95 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "BDB" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 96 | |
| 97 | |
| 98 | # test of QDBM-BT-A |
| 99 | rmscip-shell system . . rm. -rf casket* |
| 100 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest btwrite casket $RECNUM"` |
| 101 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest btread casket $RECNUM"` |
| 102 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 103 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "QDBM-BT-ASC" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 104 | |
| 105 | |
| 106 | # test of QDBM-BT-R |
| 107 | rmscip-shell system . . rm. -rf casket* |
| 108 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest btwrite -rnd casket $RECNUM"` |
| 109 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./qdbmtest btread -rnd casket $RECNUM"` |
| 110 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 111 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "QDBM-BT-RND" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 112 | |
| 113 | |
| 114 | # test of BDB-BT-ASC |
| 115 | rmscip-shell system . . rm. -rf casket* |
| 116 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest btwrite casket $RECNUM"` |
| 117 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest btread casket $RECNUM"` |
| 118 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 119 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "BDB-BT-ASC" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 120 | |
| 121 | |
| 122 | # test of BDB-BT-RND |
| 123 | rmscip-shell system . . rm. -rf casket* |
| 124 | WRITETIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest btwrite -rnd casket $RECNUM"` |
| 125 | READTIME=`exectimescip-shell shell shell-project 0.0.0 exectime(). "./bdbtest btread -rnd casket $RECNUM"` |
| 126 | FILESIZE=`filesizescip-shell shell shell-project 0.0.0 filesize(). casket` |
| 127 | printfscip-shell system . . printf. '%s,%s,%s,%s\n' "BDB-BT-RND" "$WRITETIME" "$READTIME" "$FILESIZE" |
| 128 | |
| 129 | |
| 130 | # remove garbage |
| 131 | rmscip-shell system . . rm. -rf casket* |
| 132 | syncscip-shell system . . sync. ; syncscip-shell system . . sync. |
| 133 | |
| 134 | |
| 135 | # exit normally |
| 136 | exit 0 |
| 137 | |
| 138 | |
| 139 | |
| 140 | # END OF FILE |