summary.prl
4.71 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/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.
#
if (defined($ENV{'SIMTOOLS'}) ) {
unshift(@INC,"$ENV{'SIMTOOLS'}/apps/scripts");
}
#if (defined($ENV{'SIMOS_DIR'})) {
# unshift(@INC,"$ENV{'SIMOS_DIR'}/src/apps/scripts");
#}
require "tree.prl";
$logfile = $ARGV[0] || "cpu.log";
$startnode = $ARGV[1] || "ROOT";
%states = ("ROOT" => ["user"],
"kernel" => ["kernel"],
"idle" => ["idle"],
"sync" => ["sync"],
"rpcwait" => ["rpcwait"],
"pal" => ["pal"]
);
$tree = &ParseTree($logfile, "modes");
$comp = SumTree($tree, $startnode, \%states, 1);
##############
##############
#pretty printing
sub PrintCount {
($format, $field) = @_;
my $total = 0;
printf "%-20s ", $field;
foreach $state (sort(keys %$comp)) {
if ($comp->{$state}{$field} != -1) {
$total += $comp->{$state}{$field};
printf $format, $comp->{$state}{$field};
} else {
printf "%15s ", "undef";
}
}
printf("| ");
printf $format, $total;
printf "\n";
}
sub PrintSep {
print "---------------------";
print "---------------------";
print "---------------------";
print "---------------------";
print "---------------------";
print "--------------------\n";
}
PrintCount("%15s ", "name");
PrintSep();
PrintCount("%15.3f ", "seconds");
PrintCount("%15.0f ", "_cycles");
PrintCount("%15.0f ", "_instr");
PrintSep();
if (1) {
foreach $i (@fieldname) {
PrintCount("%15d ",$i);
}
}
PrintSep();
for $i (@field_time) {
PrintCount("%15.3f ","time-$i");
}
PrintSep();
for $i ('cold','repl','true','false','other') {
PrintCount("%15.3f", "time-$i");
}
PrintSep();
if (1) {
for $i ('cold','true','false','repl','other') {
PrintCount("%15.3f ","missclass-$i");
}
PrintSep();
}
if (defined($fieldPos{'dL2DirtyStall'})) {
for $i ('lat-l1','lat-upg','lat-clean','lat-dirty') {
PrintCount("%15.3f ",$i);
}
PrintSep();
}
PrintCount("%15.3f ","dL1MR");
PrintCount("%15.3f ","dL2MR");
PrintSep();
PrintCount("%15.3f ","iMCPI");
PrintCount("%15.3f ","dMCPI");
PrintCount("%15.3f ","dL2MCPI");
if ($config{'FalseSharing'} eq "Yes") {
PrintSep();
PrintCount("%15.3f ","dMCPI-cold");
PrintCount("%15.3f ","dMCPI-repl");
PrintCount("%15.3f ","dMCPI-true");
PrintCount("%15.3f ","dMCPI-false");
PrintCount("%15.3f ","dMCPI-other");
}
if (0) {
PrintSep();
for $i ('L2LocalStall', 'L2RemoteStall',
'dL2RemoteStall', 'dL2LocalStall',
'iL2RemoteStall', 'iL2LocalStall') {
PrintCount("%15.0f ",$i);
}
for $i ('ilat-local','dlat-local','lat-local',
'ilat-remote','dlat-remote','lat-remote') {
PrintCount("%15.3f ",$i);
}
}
sub PrintFrac {
($nm, $f, $t) = @_;
printf "+ %-15s %6.0f\n", $nm, 100 * $f / $t;
}
sub PrintAbs {
($nm, $f) = @_;
printf "+ %-15s %10.3f\n", $nm, $f;
}
if (0) {
PrintSep();
$clock = 1.0 * $config{"Clock"};
$kexec = $comp->{"kernel"}{"seconds"};
$sync = $comp->{"sync"}{"seconds"};
$rpc = $comp->{"rpcwait"}{"seconds"};
$totkernel = $kexec + $sync + $rpc;
$tot = $comp->{"user"}{"seconds"} + $comp->{"idle"}{"seconds"} + $totkernel;
print "\n";
printf "Measurement period %.2f seconds\n", $tot / 8;
print "\nExecution time breakdown:\n\n";
PrintFrac('user', $comp->{"user"}{"seconds"}, $tot);
PrintFrac('totkernel', $totkernel, $tot);
PrintFrac(' exec', $kexec, $tot);
PrintFrac(' sync', $sync, $tot);
PrintFrac(' rpc', $rpc, $tot);
PrintFrac('idle', $comp->{"idle"}{"seconds"}, $tot);
print "\nKernel time breakdown:\n\n";
$lstall = $comp->{"kernel"}{"L2LocalStall"} / $clock;
$rstall = $comp->{"kernel"}{"L2RemoteStall"} / $clock;
$useful = $totkernel - ($lstall + $rstall + $sync + $rpc);
PrintFrac('useful', $useful, $totkernel);
PrintFrac('loc stall', $lstall, $totkernel);
PrintFrac('rem stall', $rstall, $totkernel);
PrintFrac('sync', $sync, $totkernel);
PrintFrac('rpc wait', $rpc, $totkernel);
print "\nAbsolute seconds:\n\n";
PrintAbs('kernel exec sec', $useful /8 );
PrintAbs('kernel other sec', ($totkernel - $useful) / 8);
PrintAbs('user sec', $comp->{"user"}{"seconds"} / 8);
PrintAbs('idle sec', $comp->{"idle"}{"seconds"} / 8);
print "\nInstruction counts (millions):\n\n";
PrintAbs('kexec count', $comp->{"kernel"}{"_instr"} / 1000000);
PrintAbs('user count', $comp->{"user"}{"_instr"} / 1000000);
}