diff options
author | Clark Williams <williams@redhat.com> | 2015-08-28 14:54:19 -0500 |
---|---|---|
committer | John Kacur <jkacur@redhat.com> | 2015-09-02 14:43:45 +0200 |
commit | b1c507531db2a4bdfe2708d2576ad02bbe47abd0 (patch) | |
tree | 4a2365698db21104efee8a0f6ef118e736f07572 | |
parent | a1d3737879b3e77b2a995be4f8c366039e24289b (diff) | |
download | rt-tests-b1c507531db2a4bdfe2708d2576ad02bbe47abd0.tar.gz |
hwlatdetect: initial cut at tracking the amount of SMIs that occurred during a run
Signed-off-by: Clark Williams <williams@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
-rwxr-xr-x | src/hwlatdetect/hwlatdetect.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/hwlatdetect/hwlatdetect.py b/src/hwlatdetect/hwlatdetect.py index 867856a..dbf3f67 100755 --- a/src/hwlatdetect/hwlatdetect.py +++ b/src/hwlatdetect/hwlatdetect.py @@ -1,5 +1,6 @@ #!/usr/bin/python +# (C) 2015 Clark Williams <williams@redhat.com> # (C) 2009 Clark Williams <williams@redhat.com> # # This program is free software; you can redistribute it and/or @@ -11,6 +12,7 @@ import os import time import subprocess import errno +import os.path version = "0.6" debugging = False @@ -164,6 +166,19 @@ class Detector(object): self.detector = Smi(self.debugfs) self.samples = [] self.testduration = 10 # ten seconds + self.have_msr = False + self.initsmi = [] + if os.path.exists('/usr/sbin/rdmsr'): + self.have_msr = True + self.initsmi = self.getsmicounts() + + def getsmicounts(self): + counts = [] + if self.have_msr: + p = subprocess.Popen(['/usr/sbin/rdmsr', '-a', '-d', '0x34'], stdout=subprocess.PIPE) + p.wait() + counts = [ int(x.strip()) for x in p.stdout.readlines()] + return counts def force_cleanup(self): debug("forcing unload of hwlat module") @@ -530,6 +545,16 @@ if __name__ == '__main__': info("Samples recorded: %d" % len(detect.samples)) info("Samples exceeding threshold: %d" % exceeding) + if detect.have_msr: + finishsmi = detect.getsmicounts() + total_smis = 0 + for i,count in enumerate(finishsmi): + if count > detect.initsmi[i]: + smis = count - detect.initsmi[i] + total_smis += smis + print "%d SMIs occured on cpu %d" % (smis, i) + info("SMIs during run: %d" % total_smis) + if reportfile: count = 0 f = open(reportfile, "w") |