use strict; require "asm/param.ph"; open UPTIME, "); close UPTIME; my $pid = shift or die "need pid"; open STAT, "); close STAT; my $total_time = $stat[13] + $stat[14]; my $include_dead_children = 1; if ($include_dead_children) { $total_time += $stat[15] + $stat[16]; } print $stat[21], "\n"; my $start_time = $stat[21]; my $seconds = $up[0] - $start_time / HZ(); my $pcpu; if($seconds) { $pcpu = ($total_time * 100 / HZ()) / $seconds; } print "start_time $start_time\n"; printf("%%CPU %2.2g\n", $pcpu);