De Wikidroids

The diagnostic module can do two profilling types : stack usage and CPU charge under interrupts.

Stack usage

On the reset of the AVR, this module will automatically fill the stack or the whole RAM (see diagnostic_config.h for configuration) with a mark (default : 0x55). When you call min_stack_space_available(void), it will look in the marked field for the largest continuous mark, which should be the stack left, and then return how many stack do you have. min_stack_space_available(void) can be called when you want, not necessary during the RAM consumption peak.

CPU charge

When you call show_int_loop(), the processor starts an infinite loop where it computes the time in the interrupt and output it on INTERRUPT_SHOW_PORT on bit INTERRUPT_SHOW_BIT. The duty cycle on this pin is the CPU charge. A duty cycle of 50% means that the CPU is almost free when a duty cycle of 0% means that the whole CPU time is consumed. If you look with a multimeter, the processor free time is proportinnal to the observed voltage. 0V corresponds to an always busy processor, while if you read Vcc/2 the processor is almost always free.

Boîte à outils