From 0744d6e349319c2a211558b892b2e22b705180af Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Tue, 28 Feb 2023 16:15:03 -0800 Subject: [PATCH] remove depreciated pmu contention detection --- src/perf_helpers.py | 76 --------------------------------------------- 1 file changed, 76 deletions(-) diff --git a/src/perf_helpers.py b/src/perf_helpers.py index 1b6b2a9..2070344 100644 --- a/src/perf_helpers.py +++ b/src/perf_helpers.py @@ -161,82 +161,6 @@ def enumerate_uncore(event, n): return event_list -# read the MSR register and return the value in dec format -def readmsr(msr, cpu=0): - f = os.open("/dev/cpu/%d/msr" % (cpu,), os.O_RDONLY) - os.lseek(f, msr, os.SEEK_SET) - val = struct.unpack("Q", os.read(f, 8))[0] - os.close(f) - return val - - -# parse hex to int -def parse_hex(s): - try: - return int(s, 16) - except ValueError: - raise argparse.ArgumentError("Bad hex number %s" % (s)) - - -# detect if PMU counters are in use -def pmu_contention_detect(iterations=6): - interval = 10 - msrregs = [ - "0x309", - "0x30a", - "0x30b", - "0x30c", - "0xc1", - "0xc2", - "0xc3", - "0xc4", - "0xc5", - "0xc6", - "0xc7", - "0xc8", - ] - values = [0] * len(msrregs) - prev_values = [0] * len(msrregs) - - for count in range(iterations): - for i, reg in enumerate(msrregs): - msrreg = parse_hex(reg) - values[i] = readmsr(msrreg) - - in_use = 0 - if count > 0: - for j, val in enumerate(values): - if val != prev_values[j]: - in_use = 1 - if msrregs[j] == "0x309": - print("PMU in use, hint: instructions") - if msrregs[j] == "0x30a": - print( - "PMU in use, hint: cpu-cycles or Check NMI watchdog. Try: echo 0 > /proc/sys/kernel/nmi_watchdog as sudo" - ) - if msrregs[j] == "0x30b": - print("PMU in use, hint: ref-cycles") - if ( - msrregs[j] == "0xc1" - or msrregs[j] == "0xc2" - or msrregs[j] == "0xc3" - or msrregs[j] == "0xc4" - ): - print("Some PMUs in use") - if in_use != 0: - print("FAIL: PMUs in use") - return True - - print( - "checking iteration= %d waiting for %d seconds " % ((count + 1), interval) - ) - time.sleep(interval) - prev_values = values[:] - - print("PASS: PMUs not in use") - return False - - # get linux kernel version def get_version(): version = ""