summaryrefslogtreecommitdiff
path: root/minix/commands/profile/tools/proftsc.pl
blob: d4d1afaa5f5fc2634855de48973bbee3e8112e98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/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";
#}