summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2012-02-14 18:51:21 +0000
committergnn <gnn@FreeBSD.org>2012-02-14 18:51:21 +0000
commit30bbceb660cbc03f455cd853eee60e9c8d03f369 (patch)
tree4f1ad132302f1deae57893522651112a69136772 /tools
parent91f6a0dbf947ad209636165756c0303297e5a369 (diff)
downloadFreeBSD-src-30bbceb660cbc03f455cd853eee60e9c8d03f369.zip
FreeBSD-src-30bbceb660cbc03f455cd853eee60e9c8d03f369.tar.gz
Add options for program (-p) and to turn off waiting (-w) which is now
on by default. The default is to wait after each counter is tested. Since the prompt would go to stdout you won't see it if you're redirecting the output of the executed sub-program to /dev/null, so just press return to continue or Ctrl-D to stop.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/test/hwpmc/pmctest.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/tools/test/hwpmc/pmctest.py b/tools/test/hwpmc/pmctest.py
index 41a7fde..a6aaf11 100755
--- a/tools/test/hwpmc/pmctest.py
+++ b/tools/test/hwpmc/pmctest.py
@@ -38,10 +38,14 @@
#
# To use:
#
-# pmctest.py ls > /dev/null
+# pmctest.py -p ls > /dev/null
#
# This should result in ls being run with every available counter
# and the system should neither lock up nor panic.
+#
+# The default is to wait after each counter is tested. Since the
+# prompt would go to stdout you won't see it, just press return
+# to continue or Ctrl-D to stop.
import sys
import subprocess
@@ -53,10 +57,15 @@ notcounter = ["IAF", "IAP", "TSC", "UNC", "UCF"]
def main():
- if (len(sys.argv) != 2):
- print ("usage: pmctest.py program")
+ from optparse import OptionParser
+
+ parser = OptionParser()
+ parser.add_option("-p", "--program", dest="program",
+ help="program to execute")
+ parser.add_option("-w", "--wait", action="store_true", dest="wait",
+ default=True, help="wait after each execution")
- program = sys.argv[1]
+ (options, args) = parser.parse_args()
p = subprocess.Popen(["pmccontrol", "-L"], stdout=PIPE)
counters = p.communicate()[0]
@@ -68,9 +77,15 @@ def main():
for counter in counters.split():
if counter in notcounter:
continue
- p = subprocess.Popen(["pmcstat", "-p", counter, program], stdout=PIPE)
+ p = subprocess.Popen(["pmcstat", "-p", counter, options.program],
+ stdout=PIPE)
result = p.communicate()[0]
print result
+ if (options.wait == True):
+ try:
+ value = raw_input("next?")
+ except EOFError:
+ sys.exit()
# The canonical way to make a python module into a script.
# Remove if unnecessary.
OpenPOWER on IntegriCloud