p_time for interrupt handlers?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

p_time for interrupt handlers?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: p_time for interrupt handlers?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: p_time for interrupt handlers?

Post by Giovanni »

BTW, you can measure any piece of code using the TM driver, this includes ISRs.

Giovanni
User avatar
russian
Posts: 368
Joined: Mon Oct 29, 2012 3:17 am
Has thanked: 16 times
Been thanked: 14 times

Re: p_time for interrupt handlers?

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: p_time for interrupt handlers?

Post by Giovanni »

It is already in 3.0.

Giovanni
Post Reply