footprint.prl
1.22 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/local/bin/perl5 -w
#
# Copyright (C) 1996-1998 by the Board of Trustees
# of Leland Stanford Junior University.
#
# This file is part of the SimOS distribution.
# See LICENSE file for terms of the license.
#
#
# Produce a gnuplot-type output out of the footprint function
require "getopts.pl";
&Getopts('i:n:');
$junk = 0;
if( defined($opt_i) ) {
$inputFile = $opt_i;
} else {
$inputFile = "syscalls.stats";
}
if( defined($opt_n) ) {
$wload = $opt_n;
} else {
$wload = 0;
}
open(KSTATS,$inputFile);
while(<KSTATS>) {
if(/^CONFIG/) {
($junk,$index,$val) = split(' ');
$config{$index} = $val;
#print $index," XXXX ",$val,"\n";
}
if( /^FPRINT_D/ ) {
@x = split(" ");
$syscall = $x[1];
$index = $x[2];
for $i (3..$#x) {
$val = hex($x[$i]);
$pos = 0;
while( $val > 0 ) {
if( ($val%2)==1) {
$line = 0x60000000 + (($index+$i-3)* 32 + $pos)* $config{'ICache.LineSize'} ;
print "$wload $syscall $line\n";
$val = $val -1;
}
$val = int($val/2);
$pos = $pos + 1;
}
}
}
}