February 2012
Intermediate to advanced
1184 pages
37h 17m
English
times
In list context, this function returns a four-element list giving the user and system CPU times, in seconds (probably fractional), for this process and terminated children of this process.
($user, $system, $cuser, $csystem) = times();
printf "This pid and its kids have consumed %.3f seconds\n",
$user + $system + $cuser + $csystem;In scalar context, returns just the user time. For example, to time the execution speed of a section of Perl code:
$start = times();
...
$end = times();
printf "that took %.2f CPU seconds of user time\n",
$end – $start;