minix/commands/profile/tools/proftsc.pl
Ben Gras 7195fe3325 System statistical and call profiling
support by Rogier Meurs <rogier@meurs.org>.
2006-10-30 15:53:38 +00:00

33 lines
680 B
Perl
Executable file

#!/usr/local/bin/perl
$SAMPLE_SZ = 8;
$file = shift;
open (FILE, $file) or die ("Unable to open $file: $!");
$_ = <FILE>;
until (eof(FILE)) {
read(FILE, $buf, $SAMPLE_SZ) == $SAMPLE_SZ or die ("Short read.");
($high, $low) = unpack("II", $buf);
if ($high - $prevhigh == 0) {
push (@res, $low - $prevlow);
}
$prevhigh = $high;
$prevlow = $low;
#print "$high $low\n";
# $pcs{$pc}++ if ($exe eq "kernel");
}
foreach $diff (sort { $a <=> $b } @res) {
print $diff."\n";
}
#foreach $pc (sort { $a <=> $b } keys %pcs) {
# print "$pc $pcs{$pc}\n";
#}