mirror of
https://github.com/LTTLabsOSS/markbench-tests.git
synced 2026-01-08 21:48:00 -05:00
James round seconds (#129)
this is a ford of jd/harness-fixes that is currently live on the benches, the ONLY thing i changed is im rounding the timestamps to the nearest second please approve --------- Co-authored-by: J-Doiron <139803019+J-Doiron@users.noreply.github.com>
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
# 3DMark
|
||||
# UL Procyon AI Text Generation
|
||||
|
||||
Runs one of the 3DMark benchmark scenes and reads the Performance Graphics Score result from the output.
|
||||
Runs the UL Procyon AI Text Generation benchmark using a specified engine and reads the Performance Score result from the output.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.10+
|
||||
- 3DMark Professional Edition installed in default location and activated.
|
||||
- Desired benchmarks are downloaded,.
|
||||
- UL Procyon installed in default location and activated with at least the AI tests
|
||||
- AI Text Generation Benchmark DLC installed
|
||||
|
||||
## Options
|
||||
|
||||
- `--benchmark` Specifies the benchmark to run.
|
||||
- `--engine` Specifies the hardware to benchmark.
|
||||
|
||||
## Output
|
||||
|
||||
report.json
|
||||
- `test`: The name of the selected benchmark
|
||||
- `score`: 3DMark gpu score
|
||||
- `start_time`: number representing a timestamp of the test's start time in milliseconds
|
||||
- `end_time`: number representing a timestamp of the test's end time in milliseconds
|
||||
- `end_time`: number representing a timestamp of the test's end time in milliseconds
|
||||
- `test`: The name of the selected benchmark
|
||||
- `test_version`: The version of the benchmark
|
||||
- `procyon_version`: The version of Procyon used
|
||||
- `score`: The text generation scores
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""3DMark test script"""
|
||||
"""UL Procyon AI Text Generation test script"""
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
from pathlib import Path
|
||||
@@ -6,7 +6,7 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
import psutil
|
||||
from utilities import regex_find_score_in_xml, is_process_running, get_install_path
|
||||
from utils import regex_find_score_in_xml, is_process_running, get_install_path, find_procyon_version, find_test_version
|
||||
|
||||
PARENT_DIR = str(Path(sys.path[0], ".."))
|
||||
sys.path.append(PARENT_DIR)
|
||||
@@ -196,13 +196,18 @@ try:
|
||||
sys.exit(1)
|
||||
|
||||
report = {
|
||||
"test": test_type[0],
|
||||
"unit": "score",
|
||||
"score": score,
|
||||
"start_time": seconds_to_milliseconds(start_time),
|
||||
"end_time": seconds_to_milliseconds(end_time)
|
||||
"end_time": seconds_to_milliseconds(end_time),
|
||||
"test": test_type[0],
|
||||
"test_version": find_test_version(),
|
||||
"procyon_version": find_procyon_version(),
|
||||
"unit": "score",
|
||||
"score": score
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
session_report.append(report)
|
||||
|
||||
write_report_json(LOG_DIR, "report.json", session_report)
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
"""3dmark test utils"""
|
||||
from pathlib import Path
|
||||
import psutil
|
||||
import winreg
|
||||
import re
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
LOG_DIR = SCRIPT_DIR / "run"
|
||||
|
||||
def is_process_running(process_name):
|
||||
"""check if given process is running"""
|
||||
for process in psutil.process_iter(['pid', 'name']):
|
||||
if process.info['name'] == process_name:
|
||||
return process
|
||||
return None
|
||||
|
||||
def regex_find_score_in_xml(result_regex):
|
||||
"""Reads score from local game log"""
|
||||
score_pattern = re.compile(result_regex)
|
||||
cfg = f"{LOG_DIR}\\result.xml"
|
||||
score_value = 0
|
||||
with open(cfg, encoding="utf-8") as file:
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
score_match = score_pattern.search(line)
|
||||
if score_match is not None:
|
||||
score_value = score_match.group(1)
|
||||
return score_value
|
||||
|
||||
def get_install_path() -> str:
|
||||
"""Gets the path to the Steam installation directory from the SteamPath registry key"""
|
||||
reg_path = r"Software\UL\Procyon"
|
||||
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, reg_path, 0, winreg.KEY_READ)
|
||||
value, _ = winreg.QueryValueEx(reg_key, "InstallDir")
|
||||
return value
|
||||
@@ -1,8 +1,11 @@
|
||||
"""3dmark test utils"""
|
||||
"""UL Procyon AI Text Generation test utils"""
|
||||
from pathlib import Path
|
||||
import psutil
|
||||
import winreg
|
||||
import re
|
||||
import os
|
||||
import win32api
|
||||
import logging
|
||||
|
||||
SCRIPT_DIR = Path(__file__).resolve().parent
|
||||
LOG_DIR = SCRIPT_DIR / "run"
|
||||
@@ -33,3 +36,66 @@ def get_install_path() -> str:
|
||||
reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, reg_path, 0, winreg.KEY_READ)
|
||||
value, _ = winreg.QueryValueEx(reg_key, "InstallDir")
|
||||
return value
|
||||
|
||||
def find_procyon_version() -> str:
|
||||
"""Gets the version of an executable located in the install path."""
|
||||
install_path = get_install_path()
|
||||
|
||||
if not install_path:
|
||||
logging.info("Installation path not found.")
|
||||
return None
|
||||
|
||||
exe_path = os.path.join(install_path, "ProcyonCmd.exe")
|
||||
|
||||
if not os.path.exists(exe_path):
|
||||
logging.info(f"Executable not found at {exe_path}")
|
||||
return None
|
||||
|
||||
try:
|
||||
# Get all file version info
|
||||
info = win32api.GetFileVersionInfo(exe_path, "\\")
|
||||
|
||||
# Extract FileVersionMS and FileVersionLS
|
||||
ms = info.get("FileVersionMS")
|
||||
ls = info.get("FileVersionLS")
|
||||
|
||||
if ms is None or ls is None:
|
||||
logging.info("No FileVersionMS or FileVersionLS found.")
|
||||
return None
|
||||
|
||||
# Convert to human-readable version: major.minor.build.revision
|
||||
major = ms >> 16
|
||||
minor = ms & 0xFFFF
|
||||
build = ls >> 16
|
||||
revision = ls & 0xFFFF
|
||||
|
||||
version = f"{major}.{minor}.{build}.{revision}"
|
||||
return version
|
||||
|
||||
except Exception as e:
|
||||
logging.info(f"Error retrieving version info from {exe_path}: {e}")
|
||||
return None # Return None if version info retrieval fails
|
||||
|
||||
def find_test_version() -> str:
|
||||
"""Gets the version of an executable located in the chops path."""
|
||||
chops_path = "C:\\ProgramData\\UL\\Procyon\\chops\\dlc\\ai-textgeneration-benchmark\\x64"
|
||||
|
||||
logging.info(f"The install path for the test is {chops_path}")
|
||||
|
||||
if not chops_path:
|
||||
logging.info("Installation path not found.")
|
||||
return None
|
||||
|
||||
exe_path = os.path.join(chops_path, "Handler.exe")
|
||||
|
||||
if not os.path.exists(exe_path):
|
||||
logging.info(f"Executable 'Handler.exe' not found at {exe_path}")
|
||||
return None
|
||||
|
||||
try:
|
||||
lang, codepage = win32api.GetFileVersionInfo(exe_path, "\\VarFileInfo\\Translation")[0]
|
||||
str_info_path = f"\\StringFileInfo\\{lang:04X}{codepage:04X}\\ProductVersion"
|
||||
return win32api.GetFileVersionInfo(exe_path, str_info_path)
|
||||
except Exception as e:
|
||||
logging.info(f"Error retrieving version info from {exe_path}: {e}")
|
||||
return None # Return None if version info retrieval fails
|
||||
Reference in New Issue
Block a user