Stats and IRQs

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderators: RoccoMarco, barthess

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Stats and IRQs

Postby steved » Tue Jun 16, 2020 12:39 pm

I'm using the stats module on an F767. Chibi 19.1.3.

I have code in CH_CFG_IRQ_PROLOGUE_HOOK() and CH_CFG_IRQ_EPILOGUE_HOOK() (And CH_CFG_IDLE_ENTER_HOOK(), probably not relevant)
When I added a GPT interrupting every 10uS, the proportion of code spent in ISRs went down, which was not what I was expecting.

Looking at the generated code within OSAL_IRQ_PROLOGUE(), the CH_CFG_IRQ_PROLOGUE_HOOK() code precedes the stats handling code. Arguably these should be the opposite way round for best timing accuracy; but maybe there's a good reason not to swap them.

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: Stats and IRQs

Postby Giovanni » Tue Jun 16, 2020 12:46 pm

Hi,

Statistics don't measure time spent in IRQs, measure time spent in critical sections:

- Between chSysLock() and chSysUnlock().
- Between chSysLockFromISR() and chSysUnlockFromISR().

Time spent in IRQs is not doable easily because ISRs can be preempted, that would require a TM object for each IRQ vector and that is not reasonable. You may add measurement code in specific ISRs using the TM module, probably this is what you did.

The effect of GPT could depend on relative priorities, hard to tell without details.

Giovanni

steved
Posts: 825
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 135 times

Re: Stats and IRQs

Postby steved » Tue Jun 16, 2020 1:22 pm

I have the stats module enabled, and monitoring thread performance using a corruption of the code in this thread. Just hadn't looked at exactly what the "isr" value meant!


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 18 guests