From d02cba93c3c957e43a9878c9591c5b90fc8017a2 Mon Sep 17 00:00:00 2001 From: Richard Cooper Date: Tue, 21 Mar 2023 23:35:38 +0000 Subject: [PATCH] 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 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/cpu/CpuCluster.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cpu/CpuCluster.py b/src/cpu/CpuCluster.py index 31fdc4977d..42a71122a3 100644 --- a/src/cpu/CpuCluster.py +++ b/src/cpu/CpuCluster.py @@ -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