cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the processor load

V.H
Senior

Hello,

Is there can do processor load display without operating system ?

1 ACCEPTED SOLUTION

Accepted Solutions
Danish1
Lead II

Without an operating-system or other tasking techniques, your processor is either doing things or in-a-tight-loop waiting for more things to do.

A "bare metal" approach to showing processor load would be to light an LED when the processor starts this waiting loop, and turns it off as soon as it has found something to do.

More advanced techniques are possible. Something I often do is "profile" my code, where I have a timer interrupt. Inside the interrupt-service-routine, I examine the return address to know where the processor was interrupted from and store that. (To save RAM I typically have 256 "bins" or address-ranges, and add 1 to the appropriate bin). Once I've run the code long enough to get something representative, I can then log the results.

This way I can know not only what portion of time the processor is executing at-or-near the idle routine, but also what portion of time it spends in other routines so I can know which routines are worth my effort optimising, and which ones use so little cpu time that it's not worth trying.

Hope this helps,

Danish

View solution in original post

1 REPLY 1
Danish1
Lead II

Without an operating-system or other tasking techniques, your processor is either doing things or in-a-tight-loop waiting for more things to do.

A "bare metal" approach to showing processor load would be to light an LED when the processor starts this waiting loop, and turns it off as soon as it has found something to do.

More advanced techniques are possible. Something I often do is "profile" my code, where I have a timer interrupt. Inside the interrupt-service-routine, I examine the return address to know where the processor was interrupted from and store that. (To save RAM I typically have 256 "bins" or address-ranges, and add 1 to the appropriate bin). Once I've run the code long enough to get something representative, I can then log the results.

This way I can know not only what portion of time the processor is executing at-or-near the idle routine, but also what portion of time it spends in other routines so I can know which routines are worth my effort optimising, and which ones use so little cpu time that it's not worth trying.

Hope this helps,

Danish