tree: 463eec5f7372d703f8594e69caae92d3c6135dc5 [path history] [tgz]
  1. README.md
  2. elf.py
  3. inputs.py
  4. main.py
  5. outputs.py
  6. sample.json
  7. types.py
scripts/ethosumonitor/README.md

About

The Arm(R) Ethos(TM)-U Monitor is a Python application that reads performance data from an Ethos-U (sub)system and outputs the captured data to a file on the host machine in either binary or JSON format.

Ethos-U Monitor porting guidelines

New input source

The Ethos-U Monitor currently supports three input sources: DAPLink, Linux shared memory and file. Adding support for additional input sources requires the user to modify inputs.py and implement the InputRingBuffer interface. The InputDAPLink class can be used for reference.

class InputMyCustomInputSource(InputRingBuffer):
    def __init__(self, elfFile):
        # Call base class constructor
        super().__init__(elfFile)

    def read(self, address, size):
        # Read 'size' bytes from 'address' and return a bytearray

Linux shared memory

The memory input source (please see ethosu_monitor.py memory --help) is recommended for Linux Driver Stack, where a Linux host communicates with an Ethos-U subsystem using shared memory. Please note that the EventRecorder ring buffer must be stored in shared memory that can be accessed by both Linux and the Ethos-U subsystem.

The InputMem class uses the /dev/mem device to read physical memory. The user must provide a configuration file that describes the memory mapping between Linux and the subsystem. Please see sample.json for reference.

If for example the Cortex(R)-M in the Ethos-U subsystem access 4MB of shared memory at address 0x6000'0000, and Linux access the same memory region at physical address 0x8'8000'0000, then the entry in the configuration file would look like this:

{
    "memoryMap": [
        {
            "host": "0x880000000",
            "device": "0x60000000",
            "size": "0x00400000"
        }
    ]
}

Firmware

The baremetal application demonstrates how to periodically poll the Ethos-U PMU device while an inference is running. PMU samples are written to a ring buffer in memory using the EventRecorder library. For users that develop their own firmware this application and the libraries it depends on serves as reference.

The ring buffer holding the EventRecorder data is recommended to be allocated large enough to store all samples for an inference. This is to prevent buffer overflows and loss of profiling data.

The ring buffer size is configured by EventRecorderConf.h. Please refer to targets/corstone-300/CMakeLists.txt and targets/corstone-300/event_recorder/EventRecorderConf.h for an example how to override the default EventRecorder settings.

For Linux systems that use /dev/mem to read profiling data, the EventRecorder BSS segment must be stored in shared memory. For a scatter file it would look something like this:

SHARED_MEMORY 0x60000000 0x20000000
{
    DDR 0x60000000
    {
        EventRecorder.o (+ZI)
    }
}