Date: Thu, 08 Jan 2026 04:14:57 +0000 From: George V. Neville-Neil <gnn@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e2bedc7d6992 - main - Extend the script to collect gprof data Message-ID: <695f2f41.2403e.57b5cc96@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by gnn: URL: https://cgit.FreeBSD.org/src/commit/?id=e2bedc7d69926426a710d035df51e0a0812d38b1 commit e2bedc7d69926426a710d035df51e0a0812d38b1 Author: George V. Neville-Neil <gnn@FreeBSD.org> AuthorDate: 2026-01-08 04:13:04 +0000 Commit: George V. Neville-Neil <gnn@FreeBSD.org> CommitDate: 2026-01-08 04:14:52 +0000 Extend the script to collect gprof data While we're at it, switch to simple waiting from communicate() calls. --- tools/test/hwpmc/pmctest.py | 31 +++++++++++++++++++++++++++---- 1 file 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:home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?695f2f41.2403e.57b5cc96>
