cpu: Add CpuCluster method to allow querying the number of CPUs.

Add a `__len__` method to `CpuCluster` to allow clients to query the
number of CPUs.

Change-Id: I6fe680423ed6fc301faaf75b8685b080a4774fef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69678
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Richard Cooper
2023-03-21 23:35:38 +00:00
parent 640891ac41
commit d02cba93c3

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022 Arm Limited
# Copyright (c) 2022-2023 Arm Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -51,6 +51,9 @@ class CpuCluster(SubSystem):
def __iter__(self):
return iter(self.cpus)
def __len__(self):
return len(self.cpus)
def generate_cpus(self, cpu_type: "BaseCPU", num_cpus: int):
"""
Instantiates the cpus within the cluster provided