mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
Split counting from sampling.
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
Some checks are pending
Cross-build Kernel / amd64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-22.04 (clang-15) (push) Waiting to run
Cross-build Kernel / amd64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 ubuntu-24.04 (clang-18) (push) Waiting to run
Cross-build Kernel / amd64 macos-latest (clang-18) (push) Waiting to run
Cross-build Kernel / aarch64 macos-latest (clang-18) (push) Waiting to run
This commit is contained in:
parent
9ea30bbb0e
commit
77153a491e
1 changed files with 21 additions and 4 deletions
|
|
@ -42,7 +42,8 @@ def main():
|
|||
parser = argparse.ArgumentParser(description='Exercise a program under hwpmc')
|
||||
parser.add_argument('--program', type=str, required=True, help='target program')
|
||||
parser.add_argument('--wait', action='store_true', help='Wait after each counter.')
|
||||
parser.add_argument('--exercise', action='store_true', help='Exercise the program being studied using sampling counters.')
|
||||
parser.add_argument('--count', action='store_true', help='Exercise the program being studied using counting mode pmcs.')
|
||||
parser.add_argument('--sample', action='store_true', help='Exercise the program being studied using sampling mode pmcs.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
|
@ -52,22 +53,38 @@ def main():
|
|||
print("no counters found")
|
||||
sys.exit()
|
||||
|
||||
if args.count == True and args.sample == True:
|
||||
print("Choose one of --count OR --sample.")
|
||||
sys.exit()
|
||||
|
||||
program = Path(args.program).name
|
||||
|
||||
if args.exercise == True:
|
||||
tmpdir = tempfile.mkdtemp(prefix=program + "-", suffix="-pmc")
|
||||
if args.count == True:
|
||||
tmpdir = tempfile.mkdtemp(prefix=program + "-", suffix="-counting-pmc")
|
||||
print("Exercising program ", args.program, " storing results data in ", tmpdir)
|
||||
|
||||
if args.sample == True:
|
||||
tmpdir = tempfile.mkdtemp(prefix=program + "-", suffix="-sampling-pmc")
|
||||
print("Exercising program ", args.program, " storing results data in ", tmpdir)
|
||||
|
||||
for counter in counters:
|
||||
if counter in notcounter:
|
||||
continue
|
||||
if args.exercise == True:
|
||||
if args.count == True:
|
||||
with open(tmpdir + "/" + program + "-" + counter + ".txt", 'w') as file:
|
||||
p = subprocess.Popen(["pmcstat",
|
||||
"-p", counter, args.program],
|
||||
text=True, stderr=file, stdout=file)
|
||||
result = p.communicate()[1]
|
||||
print(result)
|
||||
elif args.sample == True:
|
||||
p = subprocess.Popen(["pmcstat",
|
||||
"-O", tmpdir + "/" + program + "-" + counter + ".pmc",
|
||||
"-P", counter, args.program],
|
||||
text=True, stderr=PIPE)
|
||||
result = p.communicate()[1]
|
||||
print(result)
|
||||
|
||||
else:
|
||||
p = subprocess.Popen(["pmcstat", "-p", counter, args.program],
|
||||
text=True, stderr=PIPE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue