diff options
| author | Damien George | 2015-06-10 14:25:54 +0100 |
|---|---|---|
| committer | Damien George | 2015-12-22 21:00:20 +0000 |
| commit | 401af50dc081faa421e7caef18fde2beb15632e4 (patch) | |
| tree | 3af529bf86743dddf182c632849edf2a9ecf5f6a /stmhal/modpyb.c | |
| parent | abd0fcfc86c413d7de58f0c927ca6f598ee12950 (diff) | |
stmhal: Add pyb.irq_stats() to get statistics about IRQ calls.
Adds a lot of code, makes IRQs a bit less efficient, but is very useful
for debugging. Usage: pyb.irq_stats() returns a memory view that can be
read and written, eg:
list(pyb.irq_stats())
pyb.irq_stats()[0]
pyb.irq_stats()[0] = 0
The patch provides general IRQ_ENTER() and IRQ_EXIT() macros that can be
modified to provide further IRQ statistics if desired.
Diffstat (limited to 'stmhal/modpyb.c')
| -rw-r--r-- | stmhal/modpyb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/stmhal/modpyb.c b/stmhal/modpyb.c index be71f3f80..0f18b04ed 100644 --- a/stmhal/modpyb.c +++ b/stmhal/modpyb.c @@ -139,6 +139,9 @@ STATIC const mp_map_elem_t pyb_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_wfi), (mp_obj_t)&pyb_wfi_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&pyb_disable_irq_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&pyb_enable_irq_obj }, + #if IRQ_ENABLE_STATS + { MP_OBJ_NEW_QSTR(MP_QSTR_irq_stats), (mp_obj_t)&pyb_irq_stats_obj }, + #endif { MP_OBJ_NEW_QSTR(MP_QSTR_stop), (mp_obj_t)&machine_sleep_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_standby), (mp_obj_t)&machine_deepsleep_obj }, |
