mipsy_stats.pl
20.4 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
#!/usr/local/bin/perl5
#
# 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.
#
#
# Steve Herrod
$inputFile = "cpu.log";
$i=0;
while ($i<=$#ARGV) {
if ($ARGV[$i] eq "-H") {
$HISTMODE = 1;
} elsif ($ARGV[$i] eq "-f") {
$i++;
$inputFile = $ARGV[$i];
} else {
print "usage: mipsy_stats.pl [-f file] [-H <histogram>]\n";
}
$i++;
}
$MIPSYLOG = $inputFile;
open(MIPSYFILE, $MIPSYLOG) || die "Can't open $MIPSYLOG: $!\n";
while (<MIPSYFILE>) {
# Get Host that simulation was run on
/^HOST:(.*)/ && ($hostName = $1);
# Get the command line that the simulation used
/^Invocation:(.*)/ && ($invocation = $1);
# Get the date and time that this simulation took place
/^DATE:(.*)/ && ($date = $1);
# Get number of processors
/^MACHINE\s*NumCPUs\s+(\d+)/ && ($numProcs = $1);
# Get memory size
/^MACHINE\s*MemSize\s+(\d+)/ && ($memSize = $1);
# Get memory system
/^CONFIG MemSys\s+(\w+)/ && ($memSys = $1);
# Get start and end time
/^Simulation Start:\s+(\d+).*/ && ($startTime = $1);
/^Simulation End:\s+(\d+).*/ && ($endTime = $1);
#
# Get all of the cache parameters
#
if (/^ICACHE:\sAssoc\s=\s(\w+)\sSize\s=\s(\w+)\sLine\s=\s(\d+)*/) {
$icacheAssoc = $1;
$icacheSize = $2;
$icacheLine = $3;
}
if (/^DCACHE:\sAssoc\s=\s(\w+)\sSize\s=\s(\w+)\sLine\s=\s(\d+)*/) {
$dcacheAssoc = $1;
$dcacheSize = $2;
$dcacheLine = $3;
}
if (/^SCACHE:\sAssoc\s=\s(\w+)\sSize\s=\s(\w+)\sLine\s=\s(\d+)\sHitTime\s(\d+)*/) {
$scacheAssoc = $1;
$scacheSize = $2;
$scacheLine = $3;
$scacheHitTime = $4;
}
#
# Overall cycle count and instruction count for each processor
#
if (/^M_EVENT Total Cycles (\d+)/) {
$cycleCount = $1;
}
if (/^M_EVENT_C(\d+) Insts (\d+)/) {
$instCount += $2;
$instCount[$1] = $2;
# This will get the total number of CPUS since they are listed in order
$numCpus = $1;
}
if (/^M_EVENT_C(\d+) Bdoor Insts (\d+)/) {
$bdoorInstCount += $2;
$bdoorInstCount[$1] = $2;
}
if (/^M_EVENT_C(\d+) Bdoor Cycles (\d+)/) {
$bdoorCycleCount += $1;
$bdoorCycleCount[$1] = $2;
}
if (/^M_EVENT_C(\d+) FP-Insts (\d+)/) {
$fpInstCount += $2;
$fpInstCount[$1] = $2;
}
if (/^M_EVENT_C(\d+) Halted Time (\d+)/) {
$haltedTime += $2;
$haltedTime[$1] = $2;
}
#
# Sync op and prefetch statistics
#
if (/^M_EVENT_C(\d+) SyncOps (\d+)/) {
$syncOps += $2;
$syncOps[$1] = $2;
}
if (/^M_EVENT_C(\d+) SyncOpStallTime (\d+)/) {
$syncOpStallTime += $2;
$syncOpStallTime[$1] = $2;
}
if (/^M_EVENT_C(\d+) Prefetches (\d+)/) {
$prefetches += $2;
$prefetches[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchExclusives (\d+)/) {
$prefetchXs += $2;
$prefetchXs[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchL1Hits (\d+)/) {
$prefetchL1Hits += $2;
$prefetchL1Hits[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXL1Hits (\d+)/) {
$prefetchXL1Hits += $2;
$prefetchXL1Hits[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchL2Hits (\d+)/) {
$prefetchL2Hits += $2;
$prefetchL2Hits[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXL2Hits (\d+)/) {
$prefetchXL2Hits += $2;
$prefetchXL2Hits[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchMerges (\d+)/) {
$prefetchMerges += $2;
$prefetchMerges[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXMerges (\d+)/) {
$prefetchXMerges += $2;
$prefetchXMerges[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchUpgrades (\d+)/) {
$prefetchUpgrades += $2;
$prefetchUpgrades[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXUpgrades (\d+)/) {
$prefetchXUpgrades += $2;
$prefetchXUpgrades[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchStalls (\d+)/) {
$prefetchStalls += $2;
$prefetchStalls[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXStalls (\d+)/) {
$prefetchXStalls += $2;
$prefetchXStalls[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchMHTStall (\d+)/) {
$prefetchMHTStall += $2;
$prefetchMHTStall[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXMHTStall (\d+)/) {
$prefetchXMHTStall += $2;
$prefetchXMHTStall[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchTLBMisses (\d+)/) {
$prefetchTLBMisses += $2;
$prefetchTLBMisses[$1] = $2;
}
if (/^M_EVENT_C(\d+) PrefetchXTLBMisses (\d+)/) {
$prefetchXTLBMisses += $2;
$prefetchXTLBMisses[$1] = $2;
}
#
# Loads, Stores, Cache Stats
#
if (/^C(\d+) libc Wait Time: (\d+)*/) {
$libcWait += $2;
$libcWait[$1] = $2;
}
if (/^C(\d+) Stall Time: (\d+)*/) {
$cacheStall[$1] = $2;
$totalCacheStall += $2;
}
if (/^C(\d+) I Misses: (\d+) I Refs: (\d+)*/) {
$iRefs[$1] = $3;
$iMisses[$1] = $2;
$totalIRefs += $3;
$totalIMisses += $2;
}
if (/^C(\d+) IGet Retries (\d+)*/) {
$totalIGetRetries += $2;
$totalRetries += $2;
}
if (/^C(\d+) DGet Retries (\d+)*/) {
$totalDGetRetries += $2;
$totalRetries += $2;
}
if (/^C(\d+) DGetX Retries (\d+)*/) {
$totalDGetXRetries += $2;
$totalRetries += $2;
}
if (/^C(\d+) D Read Misses: (\d+) Reads: (\d+)*/) {
$dReads[$1] = $3;
$dReadMisses[$1] = $2;
$totalDReads += $3;
$totalDReadMisses += $2;
}
if (/^C(\d+) D Write Misses: (\d+) Writes: (\d+)*/) {
$dWrites[$1] = $3;
$dWriteMisses[$1] = $2;
$totalDWrites += $3;
$totalDWriteMisses += $2;
}
if (/^C(\d+) D Upgrades (\d+) Writebacks (\d+)*/) {
$upgrades[$1] = $2;
$totalUpgrades += $2;
}
if (/^C(\d+) S IMisses (\d+) IRefs: (\d+)*/) {
$sIGets[$1] = $3;
$sIGetMisses[$1] = $2;
$totalSIGets += $3;
$totalSIGetMisses += $2;
}
if (/^C(\d+) S DMisses: GetMisses (\d+) GetRefs (\d+)*/) {
$sDGets[$1] = $3;
$sDGetMisses[$1] = $2;
$totalSDGets += $3;
$totalSDGetMisses += $2;
}
if (/^C(\d+) S DMisses: GetXMisses (\d+) GetXRefs (\d+)*/) {
$sDGetXs[$1] = $3;
$sDGetXMisses[$1] = $2;
$totalSDGetXs += $3;
$totalSDGetXMisses += $2;
}
if (/^C(\d+) S UpgMisses: (\d+) UpgRefs: (\d+)*/) {
$sUpgradeRefs[$1] = $3;
$sUpgradeMisses[$1] = $2;
$totalSUpgradeRefs += $3;
$totalSUpgradeMisses += $2;
}
if (/^C(\d+) S IGetMHTRetries (\d+) DGetMHTRetries (\d+) DGetXMHTRetries (\d+) DUGetXMHTRetries (\d+)*/) {
$sIGetMHTRetries[$1] = $2;
$totalSIGetMHTRetries += $2;
$sDGetMHTRetries[$1] = $3;
$totalSDGetMHTRetries += $3;
$sDGetXMHTRetries[$1] = $4;
$totalSDGetXMHTRetries += $4;
$sDUGetXMHTRetries[$1] = $5;
$totalSDUGetXMHTRetries += $5;
$totalSMHTRetries += $2 + $3 + $4 + $5;
}
# Sync stats used when running in solo
if (/^C(\d+) locks (\d+) retries (\d+) unlocks (\d+) barriers (\d+)*/) {
$locks[$1] = $2;
$locks += $2;
$retries[$1] = $3;
$retries += $3;
$unlocks[$1] = $4;
$unlocks += $4;
$barriers[$1] = $5;
$barriers += $5;
}
if (/^C(\d+) lock n (\d+) sumX (\d+) */) {
$statsLocks[$1] = $2;
$statsLocks += $2;
$statsLockTime[$1] = $3;
$statsLockTime += $3;
}
if (/^C(\d+) barrier n (\d+) sumX (\d+) */) {
$statsBarriers[$1] = $2;
$statsBarriers += $2;
$statsBarrTime[$1] = $3;
$statsBarrTime += $3;
}
}
&DO_HEADER_INFO();
&PRINT_DIVIDER();
&DO_SUMMARY_STATS();
&PRINT_DIVIDER();
&DO_PCACHE_STATS();
&PRINT_DIVIDER();
&DO_SCACHE_STATS();
&PRINT_DIVIDER();
# SAH Turning this off for now
# &DO_PREFETCH_STATS();
&PRINT_DIVIDER();
&DO_SYNC_STATS();
#&PRINT_DIVIDER();
#&DO_MEMORY_STATS();
exit(0);
#################################################################
# Procedures that manipulate and print the scanned in numbers
#################################################################
sub numerically { $a <=> $b;}
sub div {
my $x = shift;
my $y = shift;
if ($y == 0) {
return 0.0;
} else {
return $x/$y;
}
}
sub PRINT_DIVIDER {
printf("\n********************************************************\n");
}
sub DO_HEADER_INFO {
printf("****************************\n");
printf("* MIPSY SIMULATION RESULTS *\n");
printf("****************************\n");
printf("Simulation Call: %s\n", $invocation);
printf("Simulation Host: %s\n", $hostName);
printf("Simulation Date: %s\n\n", $date);
$simulationTime = $endTime - $startTime;
printf("Simulation Time: %d Hours %d Minutes %d Seconds\n",
$simulationTime/3600, ($simulationTime/60)%60,
$simulationTime % 60);
printf("Average KIPs: %.2lf\n",
&div($instCount,$simulationTime) / 1000);
}
sub DO_SUMMARY_STATS {
printf("Total Instructions: %8.0lf\n", $instCount);
printf("(Floating Point): %8.0lf\n", $fpInstCount);
printf("(Bdoor Insts): %8.0lf\n\n", $bdoorInstCount);
printf("Total Cycles: %.0lf\n", $cycleCount);
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf("\nCPU %d\n*******\n", $cpu);
printf("Total Instructions: %8.0lf (%.2lf%%)\n", $instCount[$cpu],
100.0 * &div($instCount[$cpu], $instCount));
printf("Halted Cycles: %8.0lf (%.2lf%%)\n", $haltedTime[$cpu],
100.0 * &div($haltedTime[$cpu], $cycleCount));
$totalStall[$cpu] = $cacheStall[$cpu] + $libcWait[$cpu];
printf("Total Stall Cycles: %8.0lf (%.2lf%%)\n", $totalStall[$cpu],
100.0 * &div($cacheStall[$cpu], $cycleCount));
printf(" (Libc Wait): %12.0lf (%.2lf%%)\n", $libcWait[$cpu],
100.0 * &div($libcWait[$cpu], $totalStall[$cpu]));
}
}
sub DO_PCACHE_STATS {
printf("\n1st Level Instruction Cache\n");
printf("***************************\n");
printf("Size = %s\t Line Size = %d\n", $icacheSize, $icacheLine);
if ($icacheAssoc == 1) {
printf("Direct-Mapped\n\n");
} else {
printf("%d-way set associative\n\n", $icacheAssoc);
}
printf("%-25s %9s %12s\n", Operation, Count, Percentage);
printf("------------------------------------------------\n");
printf("%-25s %9d %11.2f%%\n", Refs, $totalIRefs, 100.0);
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $iRefs[$cpu],
100.0 * &div($iRefs[$cpu], $totalIRefs));
}
printf("%-25s %9d %11.2f%%\n", Misses, $totalIMisses,
100.0 * &div($totalIMisses,$totalIRefs));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $iMisses[$cpu],
100.0 * &div($iMisses[$cpu], $iRefs[$cpu]));
}
printf("\n1st Level Data Cache\n");
printf("*********************\n");
printf("Size = %s\tLine Size = %d\n", $dcacheSize, $dcacheLine);
if ($dcacheAssoc == 1) {
printf("Direct-Mapped\n\n");
} else {
printf("%d-way set associative\n\n", $dcacheAssoc);
}
printf("%-25s %9s %12s\n", Operation, Count, Percentage);
printf("------------------------------------------------\n");
$totalDRefs = $totalDReads + $totalDWrites;
printf("%-25s %9d %11.2f%%\n", Refs, $totalDRefs, 100.0);
printf("%-25s %9d %11.2f%%\n", Reads, $totalDReads,
100.0* &div($totalDReads,$totalDRefs));
printf("%-25s %9d %11.2f%%\n", Writes, $totalDWrites,
100.0* &div($totalDWrites,$totalDRefs));
printf("%-25s %9d %11.2f%%\n", ReadMisses, $totalDReadMisses,
100.0* &div($totalDReadMisses,$totalDReads));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $dReadMisses[$cpu],
100.0 * &div($dReadMisses[$cpu], $dReads[$cpu]));
}
printf("%-25s %9d %11.2f%%\n", WriteMisses, $totalDWriteMisses,
100.0* &div($totalDWriteMisses,$totalDWrites));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $dWriteMisses[$cpu],
100.0 * &div($dWriteMisses[$cpu], $dWrites[$cpu]));
}
printf("%-25s %9d %11.2f%%\n", Upgrades, $totalUpgrades, 100);
}
sub DO_SCACHE_STATS {
printf("\n2nd Level Unified Cache\n");
printf("************************\n");
printf("Size = %s\tLine Size = %d\n", $scacheSize, $scacheLine);
if ($scacheAssoc == 1) {
printf("Direct-Mapped\n\n");
} else {
printf("%d-way set associative\n\n", $scacheAssoc);
}
printf("%-25s %9s %12s\n", Operation, Count, Percentage);
printf("------------------------------------------------\n");
$totalSIGets = $totalSIGets - $totalSIGetMHTRetries;
$totalSDGets = $totalSDGets - $totalDGetRetries
- $totalSDGetMHTRetries;
# WATCH OUT FOR THIS!
# some things start as a getx for the l2 and then they
# need an upgrade. If the upgrade has an MHT conflict
# then future retries count as SDUGetXMHTRetries.
$totalSDGetXs = $totalSDGetXs - $totalDGetXRetries
- $totalSDGetXMHTRetries - $totalSDUGetXMHTRetries;
$totalSRefs = $totalSIGets + $totalSDGets + $totalSDGetXs;
$totalL1Misses = $totalDReadMisses + $totalDWriteMisses + $totalIMisses;
if ($totalSRefs != $totalL1Misses) {
printf(" WARNING: L1 Misses = %d\t L2 Refs = %d\n",
$totalL1Misses, $totalSRefs);
}
printf("%-25s %9d %11.2f%%\n", Refs, $totalSRefs, 100.0);
if ($totalSIGets != $totalIMisses) {
printf(" WARNING: L1 I Misses = %d\t L2 I Refs = %d\n",
$totalIMisses, $totalSIGets);
}
printf("%-25s %9d %11.2f%%\n", IGets, $totalSIGets,
100.0 * &div($totalSIGets,$totalSRefs));
if ($totalSDGets != $totalDReadMisses) {
printf(" WARNING: L1 D Misses = %d\t L2 DGets = %d\n",
$totalDReadMisses, $totalSDGets);
}
printf("%-25s %9d %11.2f%%\n", DGets, $totalSDGets,
100.0 * &div($totalSDGets,$totalSRefs));
if ($totalSDGetXs != $totalDWriteMisses) {
printf(" WARNING: L1 D Write Misses = %d\t L2 DGetXs = %d\n",
$totalDWriteMisses, $totalSDGetXs);
}
printf("%-25s %9d %11.2f%%\n", DGetXs, $totalSDGetXs,
100.0 * &div($totalSDGetXs,$totalSRefs));
printf("%-25s %9d %11.2f%%\n", IGetMisses, $totalSIGetMisses,
100.0 * &div($totalSIGetMisses,$totalSIGets));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $sIGetMisses[$cpu],
100.0 * &div($sIGetMisses[$cpu], $sIGets[$cpu]));
}
printf("%-25s %9d %11.2f%%\n", DGetMisses, $totalSDGetMisses,
100.0 * &div($totalSDGetMisses,$totalSDGets));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $sDGetMisses[$cpu],
100.0 * &div($sDGetMisses[$cpu], $sDGets[$cpu]));
}
printf("%-25s %9d %11.2f%%\n", DGetXMisses, $totalSDGetXMisses,
100.0 * &div($totalSDGetXMisses,$totalSDGetXs));
for ($cpu = 0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d %27.0lf %11.2lf%%\n", $cpu, $sDGetXMisses[$cpu],
100.0 * &div($sDGetXMisses[$cpu], $sDGetXs[$cpu]));
}
printf("\n%-25s %9d %11.2f%%\n", "Upgrade Refs", $totalSUpgradeRefs, 100);
printf("%-25s %9d %11.2f%%\n", "Upgrade Misses", $totalSUpgradeMisses,
100.0 * &div($totalSUpgradeMisses,$totalSUpgradeRefs));
printf("\n%-25s %9d\n", "IGet NAKed Retries", $totalIGetRetries);
printf("%-25s %9d\n", "DGet NAKed Retries", $totalDGetRetries);
printf("%-25s %9d\n", "DGetX NAKed Retries", $totalDGetXRetries);
printf("%-25s %9d\n", "IGet MHT Retries", $totalSIGetMHTRetries);
printf("%-25s %9d\n", "DGet MHT Retries", $totalSDGetMHTRetries);
printf("%-25s %9d\n", "DGetX MHT Retries", $totalSDGetXMHTRetries);
printf("%-25s %9d\n", "DUGetX MHT Retries", $totalSDUGetXMHTRetries);
}
sub DO_PREFETCH_STATS {
printf("Prefetch Stats\n");
printf("**************\n\n");
$totalPrefs = $prefetches + $prefetchXs;
printf("%-25s %9s %12s\n", Operation, Count, Percentage);
printf("------------------------------------------------\n");
printf("%-25s %9d %9.1lf", "Total Prefetches", $totalPrefs, 100.0);
printf("\n%-25s %9d %9.1lf", "Prefetch", $prefetches,
100.0 * &div($prefetches,$totalPrefs));
printf("\n%-25s %9d %9.1lf", "Prefetch TLB Miss", $prefetchTLBMisses,
100.0*&div($prefetchTLBMisses,$prefetches));
printf("\n%-25s %9d %9.1lf", "Prefetch L1-Hits", $prefetchL1Hits,
100.0*&div($prefetchL1Hits,$prefetches));
printf("\n%-25s %9d %9.1lf", "Prefetch L2-Hits", $prefetchL2Hits,
100.0*&div($prefetchL2Hits,$prefetches));
printf("\n%-25s %9d %9.1lf", "Prefetch Merges", $prefetchMerges,
100.0*&div($prefetchMerges,$prefetches));
printf("\n%-25s %9d %9.1lf", "Prefetch Upgrades", $prefetchUpgrades,
100.0*&div($prefetchUpgrades,$prefetches));
printf("\n%-25s %9d %9.1lf", "Prefetch Stalls", $prefetchStalls,
100.0*&div($prefetchStalls,$prefetches));
printf("\n\n%-25s %9d %9.1lf", "Prefetch Exclusive", $prefetchXs,
100.0*&div($prefetchXs,$totalPrefs));
printf("\n%-25s %9d %9.1lf", "PrefetchX TLB Miss",
100.0*$prefetchXTLBMisses, &div($prefetchXTLBMisses,$prefetchXs));
printf("\n%-25s %9d %9.1lf", "PrefetchX L1-Hits", $prefetchXL1Hits,
100.0*&div($prefetchXL1Hits,$prefetchXs));
printf("\n%-25s %9d %9.1lf", "PrefetchX L2-Hits", $prefetchXL2Hits,
100.0*&div($prefetchXL2Hits,$prefetchXs));
printf("\n%-25s %9d %9.1lf", "PrefetchX Merges", $prefetchXMerges,
100.0*&div($prefetchXMerges,$prefetchXs));
printf("\n%-25s %9d %9.1lf", "PrefetchX Upgrades", $prefetchXUpgrades,
100.0*&div($prefetchXUpgrades,$prefetches));
printf("\n%-25s %9d %9.1lf", "PrefetchX Stalls", $prefetchXStalls,
100.0*&div($prefetchXStalls,$prefetches));
}
sub DO_MEMORY_STATS {
printf("Memory Stats\n");
printf("============\n");
printf("Memory System = $memSys\n");
printf("Sync Op Stall Time %9.2f\n", $syncOpStallTime);
if ($memSys eq "Uma") {
printf("Bonus -> used uma\n");
}
# print("Mem%d: Gets %d/%d Getx %d/%d Upgrades %d/%d wback %d rhints %d\n",
}
sub DO_SYNC_STATS {
printf("Sync Stats\n");
printf("==========\n\n");
printf("%-25s %9s %12s\n", Operation, Count, "Avg. Cycles");
printf("------------------------------------------------\n");
if ($locks != $statsLocks) {
printf(" Warning: lock counts (%d) don't match stats count (%d)\n",
$locks, $statsLocks);
}
if ($locks != $unlocks) {
printf(" Warning: lock counts (%d) don't match unlocks (%d)\n",
$locks, $unlocks);
}
if ($locks != 0) {
printf("%-25s %9d %12.2f\n", "Locks", $locks, $statsLockTime/$locks);
} else {
printf("%-25s %9d %12.2f\n", "Locks", $locks, 0);
}
for ($cpu=0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d\n", $cpu);
if ($locks[$cpu] != 0) {
printf(" Grabs %24d %12.2f\n", $locks[$cpu],
$statsLockTime[$cpu]/$locks[$cpu]);
} else {
printf(" Grabs %24d %12.2f\n", $locks[$cpu], 0);
}
printf(" Retries %24d\n", $retries[$cpu]);
}
if ($barriers != $statsBarriers) {
printf(" Warning: barr counts (%d) don't match stats count (%d)\n",
$Locks, $statsBarriers);
}
if ($barriers != 0) {
printf("\n%-25s %9d %12.2f\n", "Barriers", $barriers,
$statsBarrTime/$barriers);
} else {
printf("\n%-25s %9d \n", "Barriers", $barriers, 0);
}
for ($cpu=0; $cpu <= $numCpus; $cpu++) {
printf(" CPU %d\n", $cpu);
if ($barriers[$cpu] != 0) {
printf(" Barriers %23d %12.2f\n", $barriers[$cpu],
$statsBarrTime[$cpu]/$barriers[$cpu]);
}
}
}