updates to XZ compression test

This commit is contained in:
Nikolas
2024-07-10 08:34:36 -07:00
parent b37eb93fac
commit 58a235bfd5
5 changed files with 54 additions and 12 deletions

2
.gitignore vendored
View File

@@ -21,6 +21,8 @@ basegame_no_intro_videos.archive
c-ray-fast*
sphfract.scn
output.ppm
tq_dlss_explained_1080*
xz_5.6.2_x86*
# python
__pycache__/

View File

@@ -1,13 +1,16 @@
# Primesieve
# XZ single core compression
Wrapper for [primesieve](https://github.com/kimwalisch/primesieve) which calculates primenumbers and measures duration.
This test uses a build of [XZ Utils](https://github.com/tukaani-project/xz) to compress a 1080p Tech Quickie video at level 9 compression. It measures the duration in milliseconds the first five cores and then averages it for a total score.
> This is test is not suitable for processors that have less than 6 primary performance cores. Running this test on a processor with less will result in including efficiency/small cores in the result, skewing the scores.
## Prerequisites
- Python 3.10+
- 6+ core system
## Output
report.json
- `score`: the average duration in seconds
- `version`: the version of primesieve
- `score`: the average duration in milliseconds
- `version`: the version of xz utils

BIN
xz/xz.exe

Binary file not shown.

View File

@@ -9,6 +9,8 @@ import psutil
sys.path.insert(1, os.path.join(sys.path[0], ".."))
from xz_utils import XZ_EXECUTABLE, xz_executable_exists, copy_from_network_drive, current_time_ms
def current_time_ms():
"""Get current timestamp in milliseconds since epoch"""
return int(time.time() * 1000)
@@ -27,15 +29,15 @@ formatter = logging.Formatter(LOGGING_FORMAT)
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
# if primesieve_folder_exists() is False:
# logging.info("Downloading primesieve")
# download_primesieve()
if xz_executable_exists() is False:
logging.info("Downloading xz utils")
copy_from_network_drive()
ABS_EXECUTABLE_PATH = os.path.join(script_dir, "xz.exe")
ABS_EXECUTABLE_PATH = os.path.join(script_dir, XZ_EXECUTABLE)
scores = []
start_time = current_time_ms()
command = [ABS_EXECUTABLE_PATH, "-7", "-z", "-k", "-f", "-T1", "DNDS1FINAL.mov"]
command = [ABS_EXECUTABLE_PATH, "-9", "-z", "-k", "-f", "-T1", "tq_dlss_explained_1080p.mp4"]
processors = [0, 1, 2, 3, 4, 5]
COUNT = 0
@@ -51,18 +53,21 @@ for i in range(5):
end_time = current_time_ms()
SCORE_SUM = 0
count = 0
for score in scores:
print(score)
print(f"core {count} took {score} milliseconds")
SCORE_SUM += score
count += 1
avg_score = round(SCORE_SUM / len(scores), 2)
report = {
"start_time": start_time,
"version": "12.3",
"version": "5.6.2",
"end_time": end_time,
"score": avg_score,
"unit": "milliseconds",
"test": "XZ Compression"
"test": "XZ Single Core Compression",
"per_core_score": scores
}
with open(os.path.join(log_dir, "report.json"), "w", encoding="utf-8") as report_file:

32
xz/xz_utils.py Normal file
View File

@@ -0,0 +1,32 @@
"""utility functions for xz test script"""
import os
from pathlib import Path
import time
import shutil
XZ_EXECUTABLE = "xz_5.6.2_x86_64.exe"
SCRIPT_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
def xz_executable_exists() -> bool:
"""Check if xz has been downloaded or not"""
return os.path.isfile(os.path.join(SCRIPT_DIR, XZ_EXECUTABLE))
def copy_from_network_drive():
"""Download xz from network drive"""
source = r"\\Labs\labs\01_Installers_Utilities\xz\xz_5.6.2_x86_64.exe"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, XZ_EXECUTABLE)
shutil.copyfile(source, destination)
source = r"\\Labs\labs\03_ProcessingFiles\Compression\tq_dlss_explained_1080p.mp4"
root_dir = os.path.dirname(os.path.realpath(__file__))
destination = os.path.join(root_dir, "tq_dlss_explained_1080p.mp4")
shutil.copyfile(source, destination)
def current_time_ms():
"""Get current timestamp in milliseconds since epoch"""
return int(time.time() * 1000)