Produce benchmark JSON schema v2

- No more '(Display)' strings in the GPU names, but store devices as
  `{'name': name, 'type': 'CPU/CUDA/OPENCL', 'is_display': bool}`
- Introduces testing with py.test & pipenv. The test suite is far from
  complete, though.
This commit is contained in:
2018-08-28 12:11:01 +02:00
parent 34dd5eec25
commit 4726ee0c9c
12 changed files with 356 additions and 181 deletions

View File

@@ -2,6 +2,7 @@ import json
import platform
import subprocess
import sys
import typing
from datetime import datetime
@@ -10,9 +11,12 @@ from .third_party import cpuinfo
from .third_party import cpu_cores
from .third_party.dateutil import parser
from . import context
def _getBlenderDeviceInfo(ctx: context.Context) -> typing.List[dict]:
prefix = "Benchmark Devices: "
def _getBlenderDeviceInfo(ctx):
PREFIX = "Benchmark Devices: "
command = [ctx.blender,
"--background",
"--factory-startup",
@@ -28,8 +32,8 @@ def _getBlenderDeviceInfo(ctx):
stdout, stderr = process.communicate()
lines = stdout.decode().split("\n")
for line in lines:
if line.startswith(PREFIX):
return json.loads(line[len(PREFIX):])
if line.startswith(prefix):
return json.loads(line[len(prefix):])
return []