Skip to content

Commit

Permalink
check for perf
Browse files Browse the repository at this point in the history
  • Loading branch information
hilldani committed Aug 31, 2023
1 parent dea823d commit f43c28b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions instruction-mix.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
import subprocess
import sys

from iced_x86 import Decoder, Formatter, FormatterSyntax_ # type: ignore
from iced_x86 import Decoder, Formatter, FormatterSyntax # type: ignore
from src.common import configure_logging, crash
from src.perf_helpers import get_perf_list

formatter = Formatter(FormatterSyntax_.NASM)
formatter = Formatter(FormatterSyntax.NASM)


def get_insn(insn):
Expand All @@ -40,12 +41,13 @@ def get_insn(insn):
configure_logging(".")

if len(sys.argv) != 2 or not sys.argv[1].isdigit():
print('usage: "sudo ./cpi-flame 3 # run for 3 seconds"')
print('usage: "sudo ./instruction-mix 3 # run for 3 seconds"')
sys.exit()
if os.geteuid() != 0:
crash("Must run as root, please re-run")
if platform.system() != "Linux":
crash("PerfSpect currently supports Linux only")
get_perf_list()

logging.info("collecting...")

Expand Down
5 changes: 3 additions & 2 deletions perf-collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ def validate_file(fname):
elif args.app:
cmd += f" {args.app}"

perfargs = shlex.split(cmd)
validate_perfargs(perfargs)
if args.verbose:
logging.info(cmd)
perfargs = shlex.split(cmd)
validate_perfargs(perfargs)

psi = []
logging.info("Collection started!")
start = time.time()
Expand Down

0 comments on commit f43c28b

Please sign in to comment.