Skip to content

Commit

Permalink
openssl parser
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-fsn committed May 30, 2024
1 parent dcb76da commit 84d3870
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
37 changes: 37 additions & 0 deletions inspector/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,40 @@ def dmidecode(meta, task, task_dir) -> None:
parsed_output.append(dmi_propvals(d))
with open(os.path.join(task_dir, "parsed.json"), "w") as f:
json.dump(parsed_output, f, indent=2)


def openssl(meta, task, task_dir) -> None:
"""
Parses openssl speed -mr output from multiple, separate (one algo per run) runs, with a separator of
`ALGO: (optional -evp option) algo_name ----`
"""
data = open(os.path.join(task_dir, "stdout"), "r").read()
lines = data.splitlines()
parsed_output = []

for line in lines:
if m := re.search(r"^ALGO:( -[^\s]+ | )([^\s]+) --------------", line):
# algo start
# ALGO: -evp blake2b512 ----
# ALGO: X448 ----
algo = m.group(2)
# new test, (re)set reused variables
blocksizes = []

if m := re.search(r"^\+DT:[^\s:]+:[0-9]+:[0-9]+", line):
algo = m.group(0).split(":")[1]
if m := re.search(r"\+H(:[0-9]+)+", line):
# tells us the block sizes used for this test
# Single core example (no -multi):
# +H:16:64:256:1024
# Multi core example (-multi, even with -multi 1)
# Got: +H:16:64:256:1024:8192:16384 from 15
blocksizes = list(map(int, m.group(0).split(":")[1:]))
if m := re.search(r"^\+F:[0-9]+:" + algo + "(:[0-9.]+)+$", line):
res = m.group(0).split(":")
algo = res[2]
speed = res[3:]
for i in range(len(blocksizes)):
parsed_output.append(dict(algo=algo, block_size=blocksizes[i], speed=float(speed[i]), speed_unit="bytes/sec"))
with open(os.path.join(task_dir, "parsed.json"), "w") as f:
json.dump(parsed_output, f, indent=2)
1 change: 1 addition & 0 deletions inspector/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Openssl(lib.DockerTask):
parallel: bool = False
priority: int = 2
image: str = "ghcr.io/sparecores/benchmark:main"
parse_output: list = [parse.openssl]
version_command: str = "bash -c \"openssl version | awk '{print $2}'\""
command: str = "openssl.sh"

Expand Down

0 comments on commit 84d3870

Please sign in to comment.