📄 mxs_stats.pl
字号:
printf("FETCH stats\n"); printf(" Utilization: %4.1lf%%\n", 100 * $st{'ST_FETCHES'} / ($st{'ST_FETCHES_TRIED'} + $nz)); $stalls = $st{'ST_FETCHES_TRIED'} - $st{'ST_FETCHES'} + $nz; printf(" Stall reasons:\n"); printf(" Full IWIN: %4.1lf%%\n", 100.0 * $st{'ST_FETCH_IW_FULL'} / $stalls); printf(" Full RB %4.1lf%%\n", 100.0 * $st{'ST_FETCH_RB_FULL'} / $stalls); printf(" Stall thread: %4.1lf%%\n", 100 * ($st{'ST_FETCH_STALL_OTH'} + $st{'ST_FETCH_STALLTHREAD'}) / $stalls); printf(" Stall FPC: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLFPC'} / $stalls); printf(" Stall ICACHE: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLICACHE'} / $stalls); printf(" Stall BRANCH: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLBRANCH'} / $stalls); printf(" Stall ITLB: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLITLB'} / $stalls); printf(" Stall EXCEPT: %4.1lf%%\n", 100 * ($st{'ST_FETCH_STALLEXCEPT'} + $st{'ST_FETCH_EXPEND'}) / $stalls); printf(" Stall Rename: %4.1lf%%\n", 100 * $st{'ST_FETCH_NAME'} / $stalls); printf(" Stall Syscall: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLSYS'} / $stalls); printf(" Stall SC: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLSC'} / $stalls); printf(" Stall CP0: %4.1lf%%\n", 100 * $st{'ST_FETCH_STALLCP0'} / $stalls); printf("BRANCH prediction\n"); $correct = $st{'ST_CORRECT_FALLTHRU'} + $st{'ST_CORRECT_W_FALLTHRU'} + $st{'ST_CORRECT_W_TAKEN'} + $st{'ST_CORRECT_W_FALLTHRU'} + $st{'ST_CORRECT_TAKEN'} + $st{'ST_CORRECT_LIKELY'}; $incorrect = $st{'ST_INCORRECT_FALLTHRU'} + $st{'ST_INCORRECT_W_FALLTHRU'} + $st{'ST_INCORRECT_W_TAKEN'} + $st{'ST_INCORRECT_W_FALLTHRU'} + $st{'ST_INCORRECT_TAKEN'} + $st{'ST_INCORRECT_LIKELY'}; $predicted = $correct + $incorrect; printf("Conditional branches: %.0lf\n" , $predicted); printf(" Correctly predicted: %4.1lf%%\n", 100.0 * $correct / ($predicted + $nz)); $indjr= $st{'ST_CORRECT_IND_BR'} + $st{'ST_INCORRECT_IND_BR'}; $jretops = $st{'ST_CORRECT_JRET'} + $st{'ST_INCORRECT_JRET'}; $predicted = $indjr + $jretops; printf("Indirect jumps: %.0lf\n" , $indjr); printf(" Correctly predicted: %4.1lf%%\n", 100.0 * ($st{'ST_CORRECT_IND_BR'} + $st{'ST_CORRECT_JRET'}) / ($predicted + $nz)); printf(" Return jumps: %.0lf (%4.1lf%%)\n", $jretops, 100.0 * $jretops/($predicted + $nz)); printf(" Correctly predicted: %4.1lf%%\n", 100.0 * $st{'ST_CORRECT_JRET'}/($jretops + $nz)); printf(" Non-return jumps: %.0lf (%4.1lf%%)\n", $indjr, 100.0 * $indjr/($predicted + $nz)); printf(" Correctly predicted: %4.1lf%%\n", 100.0 * ($st{'ST_CORRECT_IND_BR'})/ ($indjr+$nz)); printf("ISSUE stats\n"); $stalls = $st{'ST_ISSUE_STALLED'}; $tries = $st{'ST_ISSUE_TRIED'}; $issue_slots = ($tries + $stalls + $nz); printf(" Issuing: %4.1f%%\n", 100.0 * $st{'ST_EXECUTED'}/$issue_slots); printf(" NoIssue: %4.1f%%\n", 100.0 - (100.0 * $st{'ST_EXECUTED'})/$issue_slots); $noissue = $issue_slots - $st{'ST_EXECUTED'} + $nz; printf(" Noissue reasons:\n"); printf(" Stalled: %4.1f%%\n", 100.0 * $st{'ST_ISSUE_STALLED'}/ $noissue); printf(" Instruction window empty: %4.1lf%%\n", 100.0 * $st{'ST_IWIN_EMPTY'} / $noissue); printf(" Instruction stalled: %4.1lf%%\n", 100.0 * $st{'ST_INST_STALLED'} / $noissue); $stalled_inst = $st{'ST_INST_STALLED'} + $nz; printf(" Register dependencies: %4.1lf%%\n", 100.0 * $st{'ST_REG_DEP'} / $stalled_inst); printf(" Primary cache delay: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_PC_DLY'} / $stalled_inst, 100.0 * $st{'ST_PC_DLY'} / $st{'ST_REG_DEP'}); printf(" Load/store queue wait: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_CACHE_LSQ'} / $stalled_inst, 100.0 * $st{'ST_CACHE_LSQ'} / $st{'ST_REG_DEP'}); printf(" Cache reject wait: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_CACHE_LBSY'} / $stalled_inst, 100.0 * $st{'ST_CACHE_LBSY'} / $st{'ST_REG_DEP'}); printf(" Load/store miss wait: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_CACHE_BUS'} / $stalled_inst, 100.0 * $st{'ST_CACHE_BUS'} / $st{'ST_REG_DEP'}); printf(" Integer multiply : %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_IMUL'} / $stalled_inst, 100.0 * $st{'ST_IMUL'} / $st{'ST_REG_DEP'}); printf(" Integer divide: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_IDIV'} / $stalled_inst, 100.0 * $st{'ST_IDIV'} / $st{'ST_REG_DEP'}); $fp_op = $st{'ST_FPADD'} + $st{'ST_FPMUL'} + $st{'ST_FPDIV'} + $st{'ST_FPSQRT'} + $st{'ST_FPCMP'} + $st{'ST_FPABS'} + $st{'ST_FPNEG'} + $st{'ST_FPCVT'}; printf(" Floating point op: %4.1lf%% (%4.1lf%%)\n", 100.0 * $fp_op / $stalled_inst, 100.0 * $fp_op / $st{'ST_REG_DEP'}); printf(" Source not issued: %4.1lf%% (%4.1lf%%)\n", 100.0 * $st{'ST_NOT_ISSUED'} / $stalled_inst, 100.0 * $st{'ST_NOT_ISSUED'} / $st{'ST_REG_DEP'}); printf(" Single threading: %4.1lf%%\n", 100.0 * $st{'ST_IWIN_FLUSH'} / $stalled_inst); printf(" Load/store dependencies: %4.1lf%%\n", 100.0 * $st{'ST_LDST_DEP'} / $stalled_inst); printf(" Branch delay: %4.1lf%%\n", 100.0 * $st{'ST_BR_DLY'} / $stalled_inst); printf(" SPEC CTL: %4.1lf%%\n", 100.0 * $st{'ST_SPEC_CTL'} / $stalled_inst); printf(" No excuse: %4.1lf%%\n", 100.0 * $st{'ST_NO_EXCUSE'} / $stalled_inst); printf("DCACHE stats\n"); $probes = $st{'ST_CACHE'} + $nz; $accesses = $st{'ST_CACHE_LOAD'}+ $st{'ST_CACHE_STORE'} + $nz; $results = $st{'ST_CACHE_HIT'} + $st{'ST_CACHE_FAILURE'} + $st{'ST_CACHE_MISS'} + $st{'ST_CACHE_SCFAILURE'}; printf(" Utilization: %4.1lf%%\n", 100.0 * $accesses/($st{'ST_RUN_CYCLES'} + $nz)); printf(" Probe: %4.1lf%%\n", 100.0 * ($probes-$accesses)/($st{'ST_RUN_CYCLES'} + $nz)); printf(" Pending: %4.1lf%%\n", 100.0* ($probes-$results)/$probes); printf(" Accesses %.0f\n", $accesses); $failed = $st{'ST_CACHE_FAILURE'} + $nz; printf(" Failed: %.0f (%4.1f%%)\n", $failed, 100.0*$failed/ $results); printf(" Hit: %.0f (%4.1lf%%)\n", $st{'ST_CACHE_HIT'}, 100.0 * $st{'ST_CACHE_HIT'}/$results); printf(" Miss: %.0f (%4.1lf%%)\n", $st{'ST_CACHE_MISS'}, 100.0 * $st{'ST_CACHE_MISS'}/$results); printf(" LoadHit %.0f (%4.1lf%%)\n", $st{'ST_CACHE_LOADHIT'}, 100.0 * $st{'ST_CACHE_LOADHIT'}/ $st{'ST_CACHE_MISS'}); printf(" SC failure: %.0f (%4.1lf%%)\n", $st{'ST_CACHE_SCFAILURE'}, 100.0 * $st{'ST_CACHE_SCFAILURE'}/$results); printf(" Cache accesses\n"); $accesses = $st{'ST_CACHE_LOAD'} + $st{'ST_CACHE_STORE'}; printf(" Loads: %.0f (%4.1lf%%)\n", $st{'ST_CACHE_LOAD'}, 100.0 * $st{'ST_CACHE_LOAD'}/$accesses); printf(" Stores: %.0f (%4.1lf%%)\n", $st{'ST_CACHE_STORE'}, 100.0 * $st{'ST_CACHE_STORE'}/$accesses); printf("LDST buffer stats\n"); $ldst_fails = $st{'ST_LDST_INVALIDLOAD'} + $st{'ST_LDST_RETIRE_SQUASH'} + $nz; $ldst_waits = $st{'ST_LDST_WAIT'} + $st{'ST_LDST_REFETCH'} + $nz; $ldst_retire = $st{'ST_LDST_RETIRE_STORE'} + $st{'ST_LDST_RETIRE_LOAD'} + $nz; $total = $ldst_fails+$ldst_waits+$ldst_retire; printf(" Ldst retires: %.0f\n", $total); printf(" Retires: %4.1f%%\n", 100.0 * $ldst_retire/$total); printf(" Loads: %4.1f%%\n", 100.0 * $st{'ST_LDST_RETIRE_LOAD'}/ $ldst_retire); printf(" Stores: %4.1f%%\n", 100.0 * $st{'ST_LDST_RETIRE_STORE'}/ $ldst_retire); printf(" Waits: %4.1f%%\n", 100.0 * $ldst_waits/$total); printf(" Waiting: %.0f (%4.1f%%)\n",$st{'ST_LDST_WAIT'}, 100 * $st{'ST_LDST_WAIT'}/$ldst_waits); printf(" Refetch: %.0f (%4.1f%%)\n",$st{'ST_LDST_REFETCH'}, 100 * $st{'ST_LDST_REFETCH'}/$ldst_waits); printf(" Fails: %4.1f%%\n", 100.0 * $ldst_fails/$total); printf(" Coherency: %.0f (%4.1f%%)\n",$st{'ST_LDST_INVALIDLOAD'}, 100 * $st{'ST_LDST_INVALIDLOAD'}/$ldst_fails); $total = $ldst_retire + $st{'ST_LDST_BUF_SQUASH'} + $nz; printf(" Ldst buffer allocate: %.lf\n", $total); printf(" Retire: %4.1lf%%\n", 100.0 * $ldst_retire/$total); printf(" Squashed: %4.1lf%%\n", 100.0 * $st{'ST_LDST_BUF_SQUASH'}/$total); printf(" Squashed active: %.0f (%4.1lf%%)\n", $st{'ST_LDST_BUF_SQUASH_ACT'}, 100.0 * $st{'ST_LDST_BUF_SQUASH_ACT'}/ $st{'ST_LDST_BUF_SQUASH'}); printf("GRAD stats\n"); $total = $st{'ST_GRADS_TRIED'} + $nz; $grads = $st{'ST_GRAD_INST'}; $stalls = $total - $grads; printf(" Instruction graduated: %4.1lf%%\n", 100.0 * $grads / $total); printf(" Graduation stalled: %4.1lf%%\n", 100.0 * $stalls / $total); $pipeline_stalls = $st{'ST_GRAD_MISCSTALL'} + $st{'ST_GRAD_EMPTYSTALL'} + $st{'ST_GRAD_SQUASHED'} + $st{'ST_GRAD_EXPEND'} + $st{'ST_GRAD_ISSUESTALL'} + $st{'ST_GRAD_PHASEASTALL'} + $st{'ST_GRAD_FLUSHSTALL'}; printf(" Pipeline stalls: %4.1f%% (%4.1f%% of stalls)\n", 100.0 * $pipeline_stalls/$total, 100.0 * $pipeline_stalls/$stalls); printf(" Issue stalls: %4.1f%% (%4.1f%%)\n", 100.0 * $st{'ST_GRAD_ISSUESTALL'}/$total, 100.0 * $st{'ST_GRAD_ISSUESTALL'}/$pipeline_stalls); printf(" PhaseA stalls: %4.1f%% (%4.1f%%)\n", 100.0 * $st{'ST_GRAD_PHASEASTALL'}/$total, 100.0 * $st{'ST_GRAD_PHASEASTALL'}/$pipeline_stalls); printf(" Misc stalls: %4.1f%% (%4.1f%%)\n", 100.0 * $st{'ST_GRAD_MISCSTALL'}/$total, 100.0 * $st{'ST_GRAD_MISCSTALL'}/$pipeline_stalls); printf(" Misc empty stall: %4.1f%% (%4.1f%%)\n", 100.0 * ($st{'ST_GRAD_EMPTYSTALL'})/$total, 100.0 * ($st{'ST_GRAD_EMPTYSTALL'})/$pipeline_stalls); printf(" Squashed instruction: %4.1f%% (%4.1f%%)\n", 100.0 * $st{'ST_GRAD_SQUASHED'}/$total, 100.0 * $st{'ST_GRAD_SQUASHED'}/$pipeline_stalls); printf(" Flush stall: %4.1f%% (%4.1f%%)\n", 100.0 * ($st{'ST_GRAD_FLUSHSTALL'})/$total, 100.0 * ($st{'ST_GRAD_FLUSHSTALL'})/$pipeline_stalls); printf(" Exception pending: %4.1f%% (%4.1f%%)\n", 100.0 * $st{'ST_GRAD_EXPEND'}/$total, 100.0 * $st{'ST_GRAD_EXPEND'}/$pipeline_stalls); printf(" Icache stall: %4.1f%% (%4.1f%% of stalls)\n", 100.0 * ($st{'ST_GRAD_ICACHESTALL'})/$total, 100.0 * ($st{'ST_GRAD_ICACHESTALL'})/$stalls); $dcache_stalls = $st{'ST_GRAD_LDSTALL'} + $st{'ST_GRAD_STSTALL'}; printf(" Dcache stall: %4.1f%% (%4.1f%% of stalls)\n", 100.0 * $dcache_stalls/$total, 100.0 * $dcache_stalls/$stalls); printf(" Load stall: %4.1f%% (%4.1f%%)\n", 100.0 * ($st{'ST_GRAD_LDSTALL'})/$total, 100.0 * ($st{'ST_GRAD_LDSTALL'})/$dcache_stalls); printf(" Store stall: %4.1f%% (%4.1f%%)\n", 100.0 * ($st{'ST_GRAD_STSTALL'})/$total, 100.0 * ($st{'ST_GRAD_STSTALL'})/$dcache_stalls); $lost = $st{'ST_FETCHES'} - $st{'ST_GRAD_INST'} - $st{'ST_GRAD_SQUASHED'}; printf("Exception lost %.0f (%4.1f%%)\n", $lost, 100.0*$lost/($st{'ST_FETCHES'}+$nz)); printf("EXCEPT stats\n"); $total = $st{'ST_EXCEPT_ITLB'} + $st{'ST_EXCEPT_INTR'} + $st{'ST_EXCEPT_COHERENCY'} + $st{'ST_EXCEPT_SWITCH'}; printf(" Exceptions taken %.0f (%.1f cycles on average)\n", $st{'ST_EXCEPT_TAKEN'}, $totalcycles/($st{'ST_EXCEPT_TAKEN'}+$nz)); printf(" ITLB misses %.0f (%4.1lf%%)\n", $st{'ST_EXCEPT_ITLB'}, 100.0 * $st{'ST_EXCEPT_ITLB'}/($st{'ST_EXCEPT_TAKEN'}+$nz)); printf(" Interrupts %.0f (%4.1lf%%)\n", $st{'ST_EXCEPT_INTR'}, 100.0 * $st{'ST_EXCEPT_INTR'}/($st{'ST_EXCEPT_TAKEN'}+$nz)); printf(" Coherency %.0f (%4.1lf%%)\n", $st{'ST_EXCEPT_COHERENCY'}, 100.0 * $st{'ST_EXCEPT_COHERENCY'}/($st{'ST_EXCEPT_TAKEN'}+$nz)); printf(" Switch %.0f (%4.1lf%%)\n", $st{'ST_EXCEPT_SWITCH'}, 100.0 * $st{'ST_EXCEPT_SWITCH'}/($st{'ST_EXCEPT_TAKEN'}+$nz)); $other = $st{'ST_EXCEPT_TAKEN'} - $total; printf(" Other %.0f (%4.1lf%%)\n", $other, 100.0 * $other/($st{'ST_EXCEPT_TAKEN'} + $nz));}sub PRINT_HISTS { if ($print_histograms == 0) { return; } printf("Thread usage histogram\n"); $sum = 0.0; $avg = 0; for ($i = 1; $i <= $maxthreadhist; $i++) { $sum += (100.0*$threadhist{$i})/$hist_samples; printf(" %d %5.2lf%% (%4.1f%%)\n", $i, (100.0*$threadhist{$i})/$hist_samples, $sum); $avg += $i * $threadhist{$i}; } printf(" Avg %5.2f\n", $avg/$hist_samples); printf("Register usage histogram\n"); $sum = 0.0; for ($i = 50; $i <= $maxreghist; $i += 5) { $v = 0; for ($j = $i; $j < $i+5; $j++) { if (defined($reghist{$j})) { $v += $reghist{$j}; } } $sum += (100.0*$v)/$hist_samples; printf(" %d-%d %5.2lf%% (%4.1lf%%)\n", $i,$i+4, (100.0*$v)/$hist_samples, $sum); } printf ("Instruction window histogram\n"); printf (" Inst LdstInst LdstDep SpecInst RegDep Squash\n"); for ($i = 0; $i <= $maxiwinhist; $i++) { foreach $k ('IWIN_INST_HIST','IWIN_LDST_HIST','IWIN_LDSTDEP_HIST', 'IWIN_SPECINST_HIST','IWIN_REGDEP_HIST','IWIN_SQUASH_HIST') { if (!defined($iwinhist{$k . $i})) { $iwinhist{$k . $i} = 0; } if ($i == 0) { $csum{$k} = $iwinhist{$k . $i}/$hist_samples; } else { $csum{$k} += $iwinhist{$k . $i}/$hist_samples; } } printf(" %3d %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%% (%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%)\n", $i, 100.0 * $iwinhist{'IWIN_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_INST_HIST'}, 100.0 * $iwinhist{'IWIN_LDST_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_LDST_HIST'}, 100.0 * $iwinhist{'IWIN_LDSTDEP_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_LDSTDEP_HIST'}, 100.0 * $iwinhist{'IWIN_SPECINST_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_SPECINST_HIST'}, 100.0 * $iwinhist{'IWIN_REGDEP_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_REGDEP_HIST'}, 100.0 * $iwinhist{'IWIN_SQUASH_HIST' . $i}/$hist_samples, 100.0 * $csum{'IWIN_SQUASH_HIST'} ); } printf ("Load/store buffer usage histogram\n"); printf (" Inst Done Pending Conflict Failed Stall\n"); for ($i = 0; $i <= $maxldsthist; $i++) { foreach $k ('LDST_INST_HIST', 'LDST_DONE_INST_HIST', 'LDST_PEND_INST_HIST', 'LDST_CONFLICT_INST_HIST', 'LDST_FAILED_INST_HIST', 'LDST_STALL_INST_HIST') { if (!defined($ldsthist{$k . $i})) { $ldsthist{$k . $i} = 0; } if ($i == 0) { $csum{$k} = $ldsthist{$k . $i}/$hist_samples; } else { $csum{$k} += $ldsthist{$k . $i}/$hist_samples; } } printf(" %3d %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%% (%3.1lf%%) %5.2lf%%(%3.1lf%%) %5.2lf%%(%3.1lf%%)\n", $i, 100.0 * $ldsthist{'LDST_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_INST_HIST'}, 100.0 * $ldsthist{'LDST_DONE_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_DONE_INST_HIST'}, 100.0 * $ldsthist{'LDST_PEND_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_PEND_INST_HIST'}, 100.0 * $ldsthist{'LDST_CONFLICT_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_CONFLICT_INST_HIST'}, 100.0 * $ldsthist{'LDST_FAILED_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_FAILED_INST_HIST'}, 100.0 * $ldsthist{'LDST_STALL_INST_HIST' . $i}/$hist_samples, 100.0 * $csum{'LDST_STALL_INST_HIST'}); } }sub Z { ($ind) = @_; if (!defined($store{$ind})) { $store{$ind} = 0; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -