Page 1 of 1

p_time for interrupt handlers?

Posted: Tue Aug 06, 2013 10:55 pm
by russian
Other than cmd_threads, what kind of CPU usage statistics do we have?

I am especially interested in the amount of time I spend within all the interrupt handlers since that's where most of my logic is. I guess the times within interrupt handlers would be too short to be measured in systicks, even if systicks would tick during the handlers. Is there anything like RDTSC register in our processors (mine is stm32)?

PS: now I am looking at what I have written and maybe I should move some of my logic out of interrupt callbacks into general threads with the callbacks only putting events into queues, but that would be a totally different story.

Re: p_time for interrupt handlers?

Posted: Wed Aug 07, 2013 7:49 am
by Giovanni
The Cortex-M DWT unit has some special counter registers, I think there is one for ISR measuring but I am not sure about its usage.

Giovanni

Re: p_time for interrupt handlers?

Posted: Wed Aug 07, 2013 12:53 pm
by Giovanni
BTW, you can measure any piece of code using the TM driver, this includes ISRs.

Giovanni

Re: p_time for interrupt handlers?

Posted: Wed Aug 07, 2013 4:50 pm
by russian
Giovanni wrote:BTW, you can measure any piece of code using the TM driver, this includes ISRs.

Giovanni


On stm32 TM uses DWT_CYCCNT register and that's exactly what I was looking for!

Is it true that ChibioOS itself does not use Time Measurement Driver? In my dreams TimeMeasurement would have a 64 bit 'total' field in addition to existing last/worst/best and it would be used for both the ISRs and regular threads. This case it would be possible to see where the ticks are being spend and compare threads and IRS as apples and apples. Please consider this as a future kernel feature.

Re: p_time for interrupt handlers?

Posted: Wed Aug 07, 2013 5:15 pm
by Giovanni
It is already in 3.0.

Giovanni