diff --git a/pmcarch b/pmcarch index 8109a2e..54d7828 100755 --- a/pmcarch +++ b/pmcarch @@ -2,6 +2,8 @@ # # pmcarch - measure and summarize architectural PMCs. # +# FROM: https://github.com/brendangregg/pmc-cloud-tools +# # USAGE: pmcarch {-C CPU | -p PID | -c CMD} [interval [duration]] # # PMCs are performance monitoring counters. This script uses the architectural @@ -68,8 +70,9 @@ if (( opt_pid )); then fi fi -# order of PMCs attempts to workaround a 3.13 issue # note that instructions is last on purpose, it triggers output +# order of PMCs attempts to workaround a 3.13 issue +# cycles are twice as a workaround for an issue perf stat -e cycles -e cycles \ -e r4f2e -e r412e \ -e r00c4 -e r00c5 -e instructions \ @@ -81,6 +84,7 @@ perf stat -e cycles -e cycles \ print htxt header = hlines } + /invalid/ { print $0 } # unsupported event { gsub(/,/, ""); } $3 == "cycles" { cycles = $2; } $3 == "r4f2e" { llcref = $2; } diff --git a/tlbstat b/tlbstat index 670be7e..b42ae84 100755 --- a/tlbstat +++ b/tlbstat @@ -2,12 +2,15 @@ # # tlbstat - measure and summarize TLBs. Uses Linux perf and PMCs. # +# FROM: https://github.com/brendangregg/pmc-cloud-tools +# # TLB: Translation Lookaside Buffer (the MMU page translation cache) # PMC: Performance Monitoring Counters # # USAGE: tlbstat {-C CPU | -p PID | -c CMD} [interval [duration]] # -# REQUIREMENTS: perf command, TLB PMCs (counters listed below) +# REQUIREMENTS: perf command, TLB PMCs (counters listed below) which may +# only be provided by Linux 4.14-ish and newer. # # Columns: # @@ -77,6 +80,7 @@ if (( opt_pid )); then fi # note that instructions is last on purpose, it triggers output +# cycles are twice as a workaround for an issue perf stat -e cycles -e cycles \ -e dtlb_load_misses.miss_causes_a_walk \ -e dtlb_store_misses.miss_causes_a_walk \ @@ -93,6 +97,7 @@ perf stat -e cycles -e cycles \ print htxt header = hlines } + /invalid/ { print $0 } # unsupported event { gsub(/,/, ""); } $3 == "cycles" { cycles = $2; } # counts: