From: Giacomo Travaglini Date: Tue, 21 Apr 2020 16:27:06 +0000 (+0100) Subject: configs: Produce list of workload types in workloads.py X-Git-Tag: v20.0.0.0~167 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43d6bbc38cb31dafcb00370fe6216b348dca18e5;p=gem5.git configs: Produce list of workload types in workloads.py Change-Id: I3f585e006704e671775af8d66d241e555d34cb08 Signed-off-by: Giacomo Travaglini Reviewed-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27970 Reviewed-by: Daniel Carvalho Tested-by: kokoro --- diff --git a/configs/example/arm/workloads.py b/configs/example/arm/workloads.py index 61e57f6a9..6952a4a80 100644 --- a/configs/example/arm/workloads.py +++ b/configs/example/arm/workloads.py @@ -37,10 +37,12 @@ from __future__ import print_function from __future__ import absolute_import +import inspect import m5 from m5.objects import * from m5.options import * +from common.ObjectList import ObjectList from common.SysPaths import binary, disk class ArmBaremetal(ArmFsWorkload): @@ -83,3 +85,12 @@ class ArmTrustedFirmware(ArmFsWorkload): # Arm Trusted Firmware will provide a PSCI implementation system._have_psci = True + +class _WorkloadList(ObjectList): + def _add_objects(self): + """Add all sub-classes of the base class in the object hierarchy.""" + modname = sys.modules[__name__] + for name, cls in inspect.getmembers(modname, self._is_obj_class): + self._sub_classes[name] = cls + +workload_list = _WorkloadList(getattr(m5.objects, 'ArmFsWorkload', None))