aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGeorge V. Neville-Neil <gnn@FreeBSD.org>2012-02-14 18:51:21 +0000
committerGeorge V. Neville-Neil <gnn@FreeBSD.org>2012-02-14 18:51:21 +0000
commitf9166e7c3da08517e9b78191c018ad9ea2439706 (patch)
tree4f1ad132302f1deae57893522651112a69136772 /tools
parentf23b9b91933977e000ec4297485d8807fbf4b684 (diff)
downloadsrc-f9166e7c3da08517e9b78191c018ad9ea2439706.tar.gz
src-f9166e7c3da08517e9b78191c018ad9ea2439706.zip
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.
Notes
Notes: svn path=/head/; revision=231698
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 41a7fdef8cc4..a6aaf119b038 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.