gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: configs: Add baremetal.py option to dump stats on PMU interrupt.

RC
Richard Cooper (Gerrit)
Thu, Apr 20, 2023 6:19 PM

Richard Cooper has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/69959?usp=email )

Change subject: configs: Add baremetal.py option to dump stats on PMU
interrupt.
......................................................................

configs: Add baremetal.py option to dump stats on PMU interrupt.

Add an option to baremetal.py to optionally enable the PMU
dumpStatsOnInterrupt feature.

Change-Id: Ie2ffe11c6aa1f3a57a58425ccec3681c780065c8

M configs/example/arm/baremetal.py
M configs/example/arm/devices.py
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/configs/example/arm/baremetal.py
b/configs/example/arm/baremetal.py
index be72ebe..c45b416 100644
--- a/configs/example/arm/baremetal.py
+++ b/configs/example/arm/baremetal.py
@@ -160,7 +160,10 @@
if args.with_pmu:
for cluster in system.cpu_cluster:
interrupt_numbers = [args.pmu_ppi_number] * len(cluster)

  •        cluster.addPMUs(interrupt_numbers)
    
  •        cluster.addPMUs(
    
  •            interrupt_numbers,
    
  •            dump_stats_on_interrupt=args.pmu_dump_stats_on_interrupt,
    
  •        )
    
    if args.exit_on_uart_eot:
        for uart in system.realview.uart:
    

@@ -284,6 +287,11 @@
"Must be an integer and a valid PPI number (16 <= int_num <= 31).",
)
parser.add_argument(

  •    "--pmu-dump-stats-on-interrupt",
    
  •    action="store_true",
    
  •    help="Dump and reset gem5 stats on PMU interrupt.",
    
  • )
  • parser.add_argument(
    "--exit-on-uart-eot",
    action="store_true",
    help="Exit simulation if any of the UARTs receive an EOT. Many "
    diff --git a/configs/example/arm/devices.py b/configs/example/arm/devices.py
    index 02574d2..c444a1d 100644
    --- a/configs/example/arm/devices.py
    +++ b/configs/example/arm/devices.py
    @@ -147,7 +147,7 @@
    cpu.connectCachedPorts(self.toL2Bus.cpu_side_ports)
    self.toL2Bus.mem_side_ports = self.l2.cpu_side
  • def addPMUs(self, ints, events=[]):
  • def addPMUs(self, ints, events=[], dump_stats_on_interrupt=False):
    """
    Instantiates 1 ArmPMU per PE. The method is accepting a list of
    interrupt numbers (ints) used by the PMU and a list of events to
    @@ -159,12 +159,17 @@
    :type ints: List[int]
    :param events: Additional events to be measured by the PMUs
    :type events: List[Union[ProbeEvent, SoftwareIncrement]]
  •    :param dump_stats_on_interrupt: If true, then dump the gem5  
    

statistics

  •        when a PMU interrupt is triggered.
    
  •    :type dump_stats_on_interrupt: bool
    
  •     """
        assert len(ints) == len(self.cpus)
        for cpu, pint in zip(self.cpus, ints):
            int_cls = ArmPPI if pint < 32 else ArmSPI
            for isa in cpu.isa:
                isa.pmu = ArmPMU(interrupt=int_cls(num=pint))
    
  •            isa.pmu.dumpStatsOnInterrupt = dump_stats_on_interrupt
                isa.pmu.addArchEvents(
                    cpu=cpu,
                    itb=cpu.mmu.itb,
    

--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69959?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ie2ffe11c6aa1f3a57a58425ccec3681c780065c8
Gerrit-Change-Number: 69959
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Cooper richard.cooper@arm.com

Richard Cooper has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/69959?usp=email ) Change subject: configs: Add baremetal.py option to dump stats on PMU interrupt. ...................................................................... configs: Add baremetal.py option to dump stats on PMU interrupt. Add an option to baremetal.py to optionally enable the PMU `dumpStatsOnInterrupt` feature. Change-Id: Ie2ffe11c6aa1f3a57a58425ccec3681c780065c8 --- M configs/example/arm/baremetal.py M configs/example/arm/devices.py 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configs/example/arm/baremetal.py b/configs/example/arm/baremetal.py index be72ebe..c45b416 100644 --- a/configs/example/arm/baremetal.py +++ b/configs/example/arm/baremetal.py @@ -160,7 +160,10 @@ if args.with_pmu: for cluster in system.cpu_cluster: interrupt_numbers = [args.pmu_ppi_number] * len(cluster) - cluster.addPMUs(interrupt_numbers) + cluster.addPMUs( + interrupt_numbers, + dump_stats_on_interrupt=args.pmu_dump_stats_on_interrupt, + ) if args.exit_on_uart_eot: for uart in system.realview.uart: @@ -284,6 +287,11 @@ "Must be an integer and a valid PPI number (16 <= int_num <= 31).", ) parser.add_argument( + "--pmu-dump-stats-on-interrupt", + action="store_true", + help="Dump and reset gem5 stats on PMU interrupt.", + ) + parser.add_argument( "--exit-on-uart-eot", action="store_true", help="Exit simulation if any of the UARTs receive an EOT. Many " diff --git a/configs/example/arm/devices.py b/configs/example/arm/devices.py index 02574d2..c444a1d 100644 --- a/configs/example/arm/devices.py +++ b/configs/example/arm/devices.py @@ -147,7 +147,7 @@ cpu.connectCachedPorts(self.toL2Bus.cpu_side_ports) self.toL2Bus.mem_side_ports = self.l2.cpu_side - def addPMUs(self, ints, events=[]): + def addPMUs(self, ints, events=[], dump_stats_on_interrupt=False): """ Instantiates 1 ArmPMU per PE. The method is accepting a list of interrupt numbers (ints) used by the PMU and a list of events to @@ -159,12 +159,17 @@ :type ints: List[int] :param events: Additional events to be measured by the PMUs :type events: List[Union[ProbeEvent, SoftwareIncrement]] + :param dump_stats_on_interrupt: If true, then dump the gem5 statistics + when a PMU interrupt is triggered. + :type dump_stats_on_interrupt: bool + """ assert len(ints) == len(self.cpus) for cpu, pint in zip(self.cpus, ints): int_cls = ArmPPI if pint < 32 else ArmSPI for isa in cpu.isa: isa.pmu = ArmPMU(interrupt=int_cls(num=pint)) + isa.pmu.dumpStatsOnInterrupt = dump_stats_on_interrupt isa.pmu.addArchEvents( cpu=cpu, itb=cpu.mmu.itb, -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69959?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-MessageType: newchange Gerrit-Project: public/gem5 Gerrit-Branch: develop Gerrit-Change-Id: Ie2ffe11c6aa1f3a57a58425ccec3681c780065c8 Gerrit-Change-Number: 69959 Gerrit-PatchSet: 1 Gerrit-Owner: Richard Cooper <richard.cooper@arm.com>