aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Elofsson <jens.elofsson@arm.com>2021-05-27 16:03:20 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2021-05-31 11:10:50 +0000
commit8b1d9ded33ec59545897ff45019d05403dba7eee (patch)
tree5a730e18597c67baa3efaa800056e4bc81dbde6f
parent701a63b693bc877fc44abd802a9b2a431d81cfbe (diff)
downloadethos-u-core-software-8b1d9ded33ec59545897ff45019d05403dba7eee.tar.gz
README for the Ethos-U Monitor.21.05
Change-Id: I17b9c0d176e1f2532661107381d641c970e63f3c
-rw-r--r--lib/ethosu_monitor/README.md76
-rw-r--r--lib/ethosu_monitor/docs/ethosu_monitor_example_usage.puml61
-rw-r--r--lib/ethosu_monitor/docs/ethosu_monitor_example_usage.svg74
3 files changed, 211 insertions, 0 deletions
diff --git a/lib/ethosu_monitor/README.md b/lib/ethosu_monitor/README.md
new file mode 100644
index 0000000..98230ef
--- /dev/null
+++ b/lib/ethosu_monitor/README.md
@@ -0,0 +1,76 @@
+# Arm(R) Ethos(TM)-U Monitor
+
+Ethos-U monitor is a library that provides an example of how to extract the
+values of the PMU registers on the Arm Ethos-U55 NPU during an ongoing
+inference, using an arbitrary timer source to trigger interrupts at a set
+interval. It implements two backends,
+[EventRecorder](https://www.keil.com/pack/doc/compiler/EventRecorder/html/index.html)
+and printf. An example application showing how to use Ethos-U monitor is
+included.
+
+## Usage
+When the Ethos-U monitor constructor is called, the user specifies which backend
+to use, as well as the
+[```EventIDs```](https://www.keil.com/pack/doc/compiler/EventRecorder/html/group__EventRecorder__Data.html#ga44fa52e2007e535753fd4ba59b84d55d)
+for the EventRecorder entries. In the second step, ``configure`` is used to
+configure which PMU registers that is to be recorded. A list of available PMU
+registers can be found in [pmu_ethosu.h](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/tree/include/pmu_ethosu.h?h=21.05-rc3#n55)
+in the core-driver repository. ```monitorSample``` is then used to record the
+values of the registers on the selected backend. Lastly, ```release```
+disables the PMU.
+
+### Functions
+| Function name | Description |
+| ----------- | ----------- |
+|```EthosUMonitor(eventRecordIds, backend)``` | ```eventRecordIds``` lists the [```EventIDs```](https://www.keil.com/pack/doc/compiler/EventRecorder/html/group__EventRecorder__Data.html#ga44fa52e2007e535753fd4ba59b84d55d) that will be associated with the list of PMU registers configured in ```configure``` when using ```EVENT_RECORDER``` as backend.<br /> ```backend``` describes which backend to use, and can be either ```PRINTF``` or ```EVENT_RECORDER``` |
+|```configure(driver, eventIds)``` | Configures the PMU to monitor the PMU registers listed in ```eventIds```. The maximum number of PMU registers to monitor is 4.|
+| ```release(driver)``` | Disables the PMU. |
+|```monitorSample(driver)``` | Samples the PMU registers configured in ```configure``` and logs them using the selected backend. |
+
+### Example
+An example on how to use Ethos-U monitor can be found in the
+[baremetal](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git/tree/applications/baremetal/main.cpp?id=afadfc1ccb22fee7463c0f7b4daf467dabe98534)
+application in the [ethosu-core-platform](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git) repository.
+
+The functions ```ethosu_inference_begin``` and ```ethosu_inference_end``` are
+defined as weak symbols in
+[ethosu_driver.c](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/tree/src/ethosu_driver.c?h=21.05-rc3#n265).
+
+ They are called by the Ethos-U driver before and after the Ethos-U custom
+ operator is executed. In the
+ [example application](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git/tree/applications/baremetal/main.cpp?id=afadfc1ccb22fee7463c0f7b4daf467dabe98534)
+ a timer source is configured to periodically trigger an interrupt, on which the
+ the configured PMU registers are sampled one by one and recorded using
+ [EventRecorder](https://www.keil.com/pack/doc/compiler/EventRecorder/html/index.html)
+ as backend. Note that the events in this example are logged from an interrupt
+ context which will impact the execution time.
+
+ Below is a sequence diagram showing a simplified version of how the different
+ components interact.
+
+![ethosu monitor](docs/ethosu_monitor_example_usage.svg "ethosu monitor sequence diagram").
+
+### Output format
+#### EventRecorder
+For each of the configured PMU registers, an event is recorded using the
+[EventRecord2](https://www.keil.com/pack/doc/compiler/EventRecorder/html/group__EventRecorder__Data.html#gab91eb760432ad0a10652a2c922db9566)
+function. Each event consists of two int32-values and an id.
+
+In the example application, the following PMU registers are recorded:
+| EventID | Value 1 | Value 2 |
+| ------- | ------- | ------- |
+| Id1 | ETHOSU_PMU_CYCLE | Register value |
+| Id2 | ETHOSU_PMU_NPU_ACTIVE | Register value |
+
+```Id1``` and ```Id2``` are defined by the ```eventRecordIds``` parameter in the
+constructor of Ethos-U monitor. ```Value 1``` is the PMU register number, as
+represented by the [ethosu_pmu_event_type enum](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-driver.git/tree/include/pmu_ethosu.h?h=21.05-rc3#n55).
+```Value 2``` is the value of the PMU register when read by the
+```monitorSample``` function.
+
+#### printf
+When using
+```printf``` the register values are printed on the format
+```ethosu_pmu_cntr<counter_no> : <register_value>```, where ```counter_no``` is
+the index (0-3) of the configured PMU register, and ```register_value``` is the
+value of the PMU register.
diff --git a/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.puml b/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.puml
new file mode 100644
index 0000000..868ac4d
--- /dev/null
+++ b/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.puml
@@ -0,0 +1,61 @@
+@startuml
+skinparam backgroundColor #FEFEFE
+
+box "Application" #Orange
+participant "Application" as app
+end box
+
+box "PMU monitor" #Orange
+participant "PMU monitor" as pmumon
+end box
+
+box "Tensorflow" #LightGreen
+participant "TFLu" as tflu
+end box
+
+box "Ethos-U" #LightBlue
+participant "Ethos-U driver" as driver
+end box
+
+box "EventRecorder" #LightBlue
+participant EventRecorder as event
+end box
+
+box "Timer source"
+participant "Timer source" as timer
+end box
+
+app -> event: EventRecorderInitialize()
+
+app -> tflu: Invoke()
+tflu -> driver: ethosu_invoke()
+
+driver -> app ++: ethosu_inference_begin(inference data, driver) [weak]
+app -> pmumon: ethosu_monitor.configure()
+pmumon -> driver: 'Configure PMU'
+pmumon -> timer: Enable timer events
+return
+
+group While the Ethos-U custom op is executing
+group Recurrent: PMU-monitor log events
+ ...
+ timer -> app++: Timer event
+ app -> pmumon: ethosu_monitor.monitorSample()
+ pmumon -> driver: 'Sample PMU registers'
+ driver --> pmumon
+ pmumon -> event : EventRecord2()
+...
+end
+end
+
+driver -> app++: ethosu_inference_end(inference data, driver) [weak]
+app -> timer: 'Disable timer events'
+app -> pmumon: ethosu_monitor.monitorSample()
+pmumon -> driver: 'Sample PMU registers'
+driver --> pmumon
+pmumon -> event : EventRecord2()
+app -> pmumon: ethosu_monitor.release()
+pmumon -> driver: 'Disable PMU'
+return
+
+@enduml
diff --git a/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.svg b/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.svg
new file mode 100644
index 0000000..42ba808
--- /dev/null
+++ b/lib/ethosu_monitor/docs/ethosu_monitor_example_usage.svg
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="826px" preserveAspectRatio="none" style="width:907px;height:826px;background:#FEFEFE;" version="1.1" viewBox="0 0 907 826" width="907px" zoomAndPan="magnify"><defs><filter height="300%" id="f1c5jdiv18jw8q" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FFA500" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="101" x="29" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="83" x="38" y="16.0669">Application</text><rect fill="#FFA500" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="114" x="270.5" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="280" y="16.0669">PMU monitor</text><rect fill="#90EE90" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="86" x="386.5" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="80" x="389.5" y="16.0669">Tensorflow</text><rect fill="#ADD8E6" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="123" x="507.5" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="56" x="541" y="16.0669">Ethos-U</text><rect fill="#ADD8E6" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="129" x="632.5" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="108" x="643" y="16.0669">EventRecorder</text><rect fill="#DDDDDD" height="811.3828" style="stroke: #A80036; stroke-width: 1.0;" width="117" x="763.5" y="4"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="95" x="774.5" y="16.0669">Timer source</text><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="101.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="74.5" y="176.8281"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="109.5313" style="stroke: #FFFFFF; stroke-width: 1.0;" width="10" x="74.5" y="383.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="74.5" y1="383.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="84.5" y1="383.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="84.5" y1="383.625" y2="383.625"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="246.9297" style="stroke: #FFFFFF; stroke-width: 1.0;" width="10" x="74.5" y="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="74.5" y1="521.1563" y2="768.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="84.5" y1="521.1563" y2="768.0859"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="202.9297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="79.5" y="556.1563"/><rect fill="#FEFEFE" filter="url(#f1c5jdiv18jw8q)" height="234.7969" style="stroke: #000000; stroke-width: 2.0;" width="883.5" x="13" y="293.3594"/><rect fill="#FEFEFE" filter="url(#f1c5jdiv18jw8q)" height="203.6641" style="stroke: #000000; stroke-width: 2.0;" width="863.5" x="23" y="317.4922"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="79" x2="79" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="79" x2="79" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="79" x2="79" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="79" x2="79" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="79" x2="79" y1="521.1563" y2="777.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="327.5" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="327.5" x2="327.5" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="327.5" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="327.5" x2="327.5" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="327.5" y1="521.1563" y2="777.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="429" x2="429" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="429" x2="429" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="429" x2="429" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="429" x2="429" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="429" x2="429" y1="521.1563" y2="777.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="568.5" x2="568.5" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="568.5" x2="568.5" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="568.5" x2="568.5" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="568.5" x2="568.5" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="568.5" x2="568.5" y1="521.1563" y2="777.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="696.5" x2="696.5" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="696.5" x2="696.5" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="696.5" x2="696.5" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="696.5" x2="696.5" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="696.5" x2="696.5" y1="521.1563" y2="777.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="821.5" x2="821.5" y1="58.4297" y2="334.625"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="821.5" x2="821.5" y1="334.625" y2="362.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="821.5" x2="821.5" y1="362.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 1.0,4.0;" x1="821.5" x2="821.5" y1="493.1563" y2="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="821.5" x2="821.5" y1="521.1563" y2="777.0859"/><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="89" x="33" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="75" x="40" y="43.1279">Application</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="89" x="33" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="75" x="40" y="796.0811">Application</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="102" x="274.5" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="88" x="281.5" y="43.1279">PMU monitor</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="102" x="274.5" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="88" x="281.5" y="796.0811">PMU monitor</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="47" x="404" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="33" x="411" y="43.1279">TFLu</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="47" x="404" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="33" x="411" y="796.0811">TFLu</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="111" x="511.5" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="97" x="518.5" y="43.1279">Ethos-U driver</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="111" x="511.5" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="97" x="518.5" y="796.0811">Ethos-U driver</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="117" x="636.5" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="103" x="643.5" y="43.1279">EventRecorder</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="117" x="636.5" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="103" x="643.5" y="796.0811">EventRecorder</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="105" x="767.5" y="23.1328"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="91" x="774.5" y="43.1279">Timer source</text><rect fill="#FEFECE" filter="url(#f1c5jdiv18jw8q)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="105" x="767.5" y="776.0859"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="91" x="774.5" y="796.0811">Timer source</text><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="101.5313" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="74.5" y="176.8281"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="109.5313" style="stroke: #FFFFFF; stroke-width: 1.0;" width="10" x="74.5" y="383.625"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="74.5" y1="383.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="84.5" y1="383.625" y2="493.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="84.5" y1="383.625" y2="383.625"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="246.9297" style="stroke: #FFFFFF; stroke-width: 1.0;" width="10" x="74.5" y="521.1563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="74.5" x2="74.5" y1="521.1563" y2="768.0859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="84.5" y1="521.1563" y2="768.0859"/><rect fill="#FFFFFF" filter="url(#f1c5jdiv18jw8q)" height="202.9297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="79.5" y="556.1563"/><polygon fill="#A80036" points="685,85.4297,695,89.4297,685,93.4297,689,89.4297" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="79.5" x2="691" y1="89.4297" y2="89.4297"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="154" x="86.5" y="84.4966">EventRecorderInitialize()</text><polygon fill="#A80036" points="417.5,114.5625,427.5,118.5625,417.5,122.5625,421.5,118.5625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="79.5" x2="423.5" y1="118.5625" y2="118.5625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="51" x="86.5" y="113.6294">Invoke()</text><polygon fill="#A80036" points="557,143.6953,567,147.6953,557,151.6953,561,147.6953" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="429.5" x2="563" y1="147.6953" y2="147.6953"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="102" x="436.5" y="142.7622">ethosu_invoke()</text><polygon fill="#A80036" points="95.5,172.8281,85.5,176.8281,95.5,180.8281,91.5,176.8281" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89.5" x2="568" y1="176.8281" y2="176.8281"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="344" x="101.5" y="171.895">ethosu_inference_begin(inference data, driver) [weak]</text><polygon fill="#A80036" points="315.5,201.9609,325.5,205.9609,315.5,209.9609,319.5,205.9609" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="321.5" y1="205.9609" y2="205.9609"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="174" x="91.5" y="201.0278">ethosu_monitor.configure()</text><polygon fill="#A80036" points="557,231.0938,567,235.0938,557,239.0938,561,235.0938" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="563" y1="235.0938" y2="235.0938"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="100" x="334.5" y="230.1606">'Configure PMU'</text><polygon fill="#A80036" points="810,260.2266,820,264.2266,810,268.2266,814,264.2266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="816" y1="264.2266" y2="264.2266"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="334.5" y="259.2935">Enable timer events</text><polygon fill="#A80036" points="557,274.3594,567,278.3594,557,282.3594,561,278.3594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="79.5" x2="563" y1="278.3594" y2="278.3594"/><rect fill="none" height="234.7969" style="stroke: #000000; stroke-width: 2.0;" width="883.5" x="13" y="293.3594"/><polygon fill="#EEEEEE" points="13,293.3594,365,293.3594,365,300.3594,355,310.3594,13,310.3594,13,293.3594" style="stroke: #000000; stroke-width: 2.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="307" x="28" y="306.4263">While the Ethos-U custom op is executing</text><rect fill="none" height="203.6641" style="stroke: #000000; stroke-width: 2.0;" width="863.5" x="23" y="317.4922"/><polygon fill="#EEEEEE" points="23,317.4922,327,317.4922,327,324.4922,317,334.4922,23,334.4922,23,317.4922" style="stroke: #000000; stroke-width: 2.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="259" x="38" y="330.5591">Recurrent: PMU-monitor log events</text><polygon fill="#A80036" points="95.5,379.625,85.5,383.625,95.5,387.625,91.5,383.625" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89.5" x2="821" y1="383.625" y2="383.625"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="76" x="101.5" y="378.6919">Timer event</text><polygon fill="#A80036" points="315.5,408.7578,325.5,412.7578,315.5,416.7578,319.5,412.7578" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84.5" x2="321.5" y1="412.7578" y2="412.7578"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="214" x="91.5" y="407.8247">ethosu_monitor.monitorSample()</text><polygon fill="#A80036" points="557,437.8906,567,441.8906,557,445.8906,561,441.8906" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="563" y1="441.8906" y2="441.8906"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="334.5" y="436.9575">'Sample PMU registers'</text><polygon fill="#A80036" points="338.5,452.0234,328.5,456.0234,338.5,460.0234,334.5,456.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="332.5" x2="568" y1="456.0234" y2="456.0234"/><polygon fill="#A80036" points="685,481.0234,695,485.0234,685,489.0234,689,485.0234" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="691" y1="485.0234" y2="485.0234"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="98" x="334.5" y="480.0903">EventRecord2()</text><polygon fill="#A80036" points="100.5,552.1563,90.5,556.1563,100.5,560.1563,96.5,556.1563" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="94.5" x2="568" y1="556.1563" y2="556.1563"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="333" x="106.5" y="551.2231">ethosu_inference_end(inference data, driver) [weak]</text><polygon fill="#A80036" points="810,581.2891,820,585.2891,810,589.2891,814,585.2891" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89.5" x2="816" y1="585.2891" y2="585.2891"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="138" x="96.5" y="580.356">'Disable timer events'</text><polygon fill="#A80036" points="315.5,610.4219,325.5,614.4219,315.5,618.4219,319.5,614.4219" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89.5" x2="321.5" y1="614.4219" y2="614.4219"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="214" x="96.5" y="609.4888">ethosu_monitor.monitorSample()</text><polygon fill="#A80036" points="557,639.5547,567,643.5547,557,647.5547,561,643.5547" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="563" y1="643.5547" y2="643.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="334.5" y="638.6216">'Sample PMU registers'</text><polygon fill="#A80036" points="338.5,653.6875,328.5,657.6875,338.5,661.6875,334.5,657.6875" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="332.5" x2="568" y1="657.6875" y2="657.6875"/><polygon fill="#A80036" points="685,682.6875,695,686.6875,685,690.6875,689,686.6875" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="691" y1="686.6875" y2="686.6875"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="98" x="334.5" y="681.7544">EventRecord2()</text><polygon fill="#A80036" points="315.5,711.8203,325.5,715.8203,315.5,719.8203,319.5,715.8203" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89.5" x2="321.5" y1="715.8203" y2="715.8203"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="162" x="96.5" y="710.8872">ethosu_monitor.release()</text><polygon fill="#A80036" points="557,740.9531,567,744.9531,557,748.9531,561,744.9531" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="327.5" x2="563" y1="744.9531" y2="744.9531"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="334.5" y="740.02">'Disable PMU'</text><polygon fill="#A80036" points="557,755.0859,567,759.0859,557,763.0859,561,759.0859" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="84.5" x2="563" y1="759.0859" y2="759.0859"/><!--
+@startuml
+skinparam backgroundColor #FEFEFE
+
+box "Application" #Orange
+participant "Application" as app
+end box
+
+box "PMU monitor" #Orange
+participant "PMU monitor" as pmumon
+end box
+
+box "Tensorflow" #LightGreen
+participant "TFLu" as tflu
+end box
+
+box "Ethos-U" #LightBlue
+participant "Ethos-U driver" as driver
+end box
+
+box "EventRecorder" #LightBlue
+participant EventRecorder as event
+end box
+
+box "Timer source"
+participant "Timer source" as timer
+end box
+
+app -> event: EventRecorderInitialize()
+
+app -> tflu: Invoke()
+tflu -> driver: ethosu_invoke()
+
+driver -> app ++: ethosu_inference_begin(inference data, driver) [weak]
+app -> pmumon: ethosu_monitor.configure()
+pmumon -> driver: 'Configure PMU'
+pmumon -> timer: Enable timer events
+return
+
+group While the Ethos-U custom op is executing
+group Recurrent: PMU-monitor log events
+ ...
+ timer -> app++: Timer event
+ app -> pmumon: ethosu_monitor.monitorSample()
+ pmumon -> driver: 'Sample PMU registers'
+ driver - -> pmumon
+ pmumon -> event : EventRecord2()
+...
+end
+end
+
+driver -> app++: ethosu_inference_end(inference data, driver) [weak]
+app -> timer: 'Disable timer events'
+app -> pmumon: ethosu_monitor.monitorSample()
+pmumon -> driver: 'Sample PMU registers'
+driver - -> pmumon
+pmumon -> event : EventRecord2()
+app -> pmumon: ethosu_monitor.release()
+pmumon -> driver: 'Disable PMU'
+return
+
+@enduml
+
+PlantUML version 1.2017.15(Mon Jul 03 18:45:34 CEST 2017)
+(GPL source distribution)
+Java Runtime: OpenJDK Runtime Environment
+JVM: OpenJDK 64-Bit Server VM
+Java Version: 11.0.10+9-Ubuntu-0ubuntu1.18.04
+Operating System: Linux
+OS Version: 4.15.0-139-generic
+Default Encoding: UTF-8
+Language: en
+Country: US
+--></g></svg> \ No newline at end of file