@@ -21,13 +21,21 @@ system state at the time of the transient event may be examined.
21
21
22
22
The following image shows the ` quick_test.py ` code being monitored at the point
23
23
when a task hogs the CPU. The top line 00 shows the "hog detect" trigger. Line
24
- 02 shows the fast running ` hog_detect ` task which cannot run at the time of the
25
- trigger because another task is hogging the CPU. Lines 01 and 03 show the ` foo `
26
- and ` bar ` tasks.
24
+ 01 shows the fast running ` hog_detect ` task which cannot run at the time of the
25
+ trigger because another task is hogging the CPU. Lines 02 and 04 show the ` foo `
26
+ and ` bar ` tasks. Line 03 shows the ` hog ` task and line 05 is a trigger issued
27
+ by ` hog() ` when it starts monopolising the CPU. The Pico issues the "hog
28
+ detect" trigger 100ms after hogging starts.
27
29
![ Image] ( ./monitor.jpg )
28
30
31
+ The following image shows brief (<4ms) hogging while ` quick_test.py ` ran. The
32
+ likely cause is garbage collection on the Pyboard D host.
33
+ ![ Image] ( ./monitor_gc.jpg )
34
+
29
35
### Status
30
36
37
+ 2nd Oct 2021 Add trigger function.
38
+
31
39
30th Sep 2021 Pico code has improved hog detection.
32
40
33
41
27th Sep 2021 SPI support added. The ` set_uart ` method is replaced by
@@ -145,7 +153,9 @@ timer may be adjusted. Other modes of hog detection are also supported. See
145
153
In general there are easier ways to debug synchronous code. However in the
146
154
context of a monitored asynchronous application there may be a need to view the
147
155
timing of synchronous code. Functions and methods may be monitored either in
148
- the declaration via a decorator or when called via a context manager.
156
+ the declaration via a decorator or when called via a context manager. Timing
157
+ markers may be inserted in code: a call to ` monitor.trigger ` will cause a Pico
158
+ pin to pulse.
149
159
150
160
## 2.1 The mon_func decorator
151
161
@@ -173,6 +183,12 @@ with mon_call(22):
173
183
It is advisable not to use the context manager with a function having the
174
184
` mon_func ` decorator. The pin and report behaviour is confusing.
175
185
186
+ ## 2.3 The trigger timing marker
187
+
188
+ A call to ` monitor.trigger(n) ` may be inserted anywhere in synchronous or
189
+ asynchronous code. When this runs, a brief (~ 80μs) pulse will occur on the Pico
190
+ pin with ident ` n ` .
191
+
176
192
# 3. Pico Pin mapping
177
193
178
194
The Pico GPIO numbers used by idents start at 3 and have a gap where the Pico
0 commit comments