xref: /minix/minix/commands/profile/tools/proftsc.pl (revision 433d6423)
1#!/usr/local/bin/perl
2
3$SAMPLE_SZ = 8;
4
5$file = shift;
6
7open (FILE, $file) or die ("Unable to open $file: $!");
8
9$_ = <FILE>;
10
11until (eof(FILE)) {
12  read(FILE, $buf, $SAMPLE_SZ) == $SAMPLE_SZ  or die ("Short read.");
13  ($high, $low) = unpack("II", $buf);
14
15  if ($high - $prevhigh == 0) {
16	push (@res, $low - $prevlow);
17  }
18
19  $prevhigh = $high;
20  $prevlow = $low;
21
22  #print "$high $low\n";
23
24#  $pcs{$pc}++ if ($exe eq "kernel");
25}
26
27foreach $diff (sort { $a <=> $b } @res) {
28	print $diff."\n";
29}
30
31#foreach $pc (sort { $a <=> $b } keys %pcs) {
32#	print "$pc $pcs{$pc}\n";
33#}
34