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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user