shell scripting
Posted: Sat Oct 27, 2007 10:46 am
I am sure there is better way to do this benchmarking. Thanks in advance for any input!
Code: Select all
#!/bin/sh
# Task benchmarking in seconds
h=`date "+%H"`
h=`expr $h \* 60`
m=`date "+%M"`
m=`expr $h + $m`
m=`expr $m \* 60`
s=`date "+%S"`
s=`expr $m + $s`
# Do the task that needs benchmark
h=`date "+%H"`
h=`expr $h \* 60`
m=`date "+%M"`
m=`expr $h + $m`
m=`expr $m \* 60`
s1=`date "+%S"`
s1=`expr $m + $s1`
s=`expr $s1 - $s`
echo $s