📄 mipsy_stats.pl
字号:
#!/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();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -