aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge V. Neville-Neil <gnn@FreeBSD.org>2026-01-08 04:13:04 +0000
committerGeorge V. Neville-Neil <gnn@FreeBSD.org>2026-01-08 04:14:52 +0000
commite2bedc7d69926426a710d035df51e0a0812d38b1 (patch)
tree93c61fb4a2e68f49b65c83c4b7ee8d94f1cc04a5
parent9b5d6ab1be32772ba86021e50e709db9a1659226 (diff)
-rwxr-xr-xtools/test/hwpmc/pmctest.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/test/hwpmc/pmctest.py b/tools/test/hwpmc/pmctest.py
index 588fe6d79e83..ba20306f1d68 100755
--- a/tools/test/hwpmc/pmctest.py
+++ b/tools/test/hwpmc/pmctest.py
@@ -26,6 +26,7 @@ from subprocess import PIPE
import argparse
import tempfile
from pathlib import Path
+import os
def gather_counters():
"""Run program and return output as array of lines."""
@@ -75,20 +76,42 @@ def main():
p = subprocess.Popen(["pmcstat",
"-p", counter, args.program],
text=True, stderr=file, stdout=file)
- result = p.communicate()[1]
+ result = p.wait()
print(result)
elif args.sample == True:
+ pmcout = tmpdir + "/" + program + "-" + counter + ".pmc"
p = subprocess.Popen(["pmcstat",
- "-O", tmpdir + "/" + program + "-" + counter + ".pmc",
+ "-O", pmcout,
"-P", counter, args.program],
text=True, stderr=PIPE)
- result = p.communicate()[1]
+ result = p.wait()
+ resdir = tmpdir + "/" + program + "-" + counter + ".results"
+ os.makedirs(resdir)
+ p = subprocess.Popen(["pmcstat",
+ "-R", pmcout,
+ "-g"],
+ cwd=resdir,
+ text=True, stderr=PIPE)
+ result = p.wait()
+ gmondir = resdir + "/" + counter
+ if Path(gmondir).is_dir():
+ with open(gmondir + "/" + "gprof.out", "w") as file:
+ p = subprocess.Popen(["gprof",
+ args.program,
+ program + ".gmon"],
+ cwd=gmondir,
+ text=True,
+ stdout=file,
+ stderr=subprocess.STDOUT)
+ result = p.wait()
+ else:
+ print ("Failed to get gmon data for ", counter)
print(result)
else:
p = subprocess.Popen(["pmcstat", "-p", counter, args.program],
text=True, stderr=PIPE)
- result = p.communicate()[1]
+ result = p.wait()
print(result)
if (args.wait == True):
try: