You can use "times" function to determine how many user and system seconds a process actually used. This will give a better measurement of the time that a process actually takes to complete, since other processes can slow the execution of your program down and skew your results. Execute this code just before exiting your script.
($user,$system,$cuser,$csystem) = times;
print "user time = $user\n";
print "system time = $system\n";
print "children user time = $user\n";
print "children system time = $system\n";