5 use Time
::HiRes
qw(gettimeofday);
8 die "Usage: $0 <prefix> <command...>\n";
11 my ($prefix, @cmd) = @ARGV;
12 my ($sec, $msec) = gettimeofday
();
16 die "$0: Failure to fork(): $!\n";
20 die "$0: Failure to exec(): $!\n";
23 $SIG{'INT'} = 'IGNORE';
24 $SIG{'QUIT'} = 'IGNORE';
26 if (waitpid($pid, 0) == -1) {
27 die "$0: Failure to waitpid(): $!\n";
30 my $exitcode = $?
>> 8;
31 my ($sec2, $msec2) = gettimeofday
();
32 my (undef, undef, $cuser, $csystem) = times();
34 printf STDERR
"%s#%.2f#%.2f#%.2f\n",
35 $prefix, $cuser, $csystem,
36 ($sec2 - $sec) + ($msec2 - $msec) / 1000000;
38 $SIG{'INT'} = 'DEFAULT';
39 $SIG{'QUIT'} = 'DEFAULT';