17 parser = argparse.ArgumentParser(
18 description=
'This script sanitizes GPU core info output from malioc',
24 help=
'The path to malioc.',
30 help=
'The output path.',
32 return parser.parse_args(argv)
36 if not args.malioc
or not os.path.isfile(args.malioc):
37 print(
'The --malioc argument must refer to the malioc binary.')
43 malioc_cores = subprocess.check_output(
44 [malioc,
'--list',
'--format',
'json'],
45 stderr=subprocess.STDOUT,
47 cores_json = json.loads(malioc_cores)
49 for core
in cores_json[
'cores']:
50 cores.append(core[
'core'])
55 malioc_info = subprocess.check_output(
56 [malioc,
'--info',
'--core', core,
'--format',
'json'],
57 stderr=subprocess.STDOUT,
59 info_json = json.loads(malioc_info)
61 apis = info_json[
'apis']
63 opengles_max_version = 0
64 if 'opengles' in apis:
65 opengles = apis[
'opengles']
66 if opengles[
'max_version']
is not None:
67 opengles_max_version = opengles[
'max_version']
68 vulkan_max_version = 0
70 vulkan = apis[
'vulkan']
71 if vulkan[
'max_version']
is not None:
72 vulkan_max_version =
int(vulkan[
'max_version'] * 100)
76 'opengles_max_version': opengles_max_version,
77 'vulkan_max_version': vulkan_max_version,
92 with open(args.output,
'w')
as file:
93 json.dump(infos, file, sort_keys=
True)
100if __name__ ==
'__main__':
101 sys.exit(
main(sys.argv))
def malioc_core_list(malioc)
def malioc_core_info(malioc, core)
def print(*args, **kwargs)