How to understand the CPU load in a Scicos app

A forum useful to discuss the details of the ScicosLab code generator.

Moderator: paolo.gai

Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

How to understand the CPU load in a Scicos app

Post by paolo.gai » Fri May 29, 2009 9:46 am

Here is an information which can be useful for everybody...

how could I know whether the control loop is running on time? (could I view the actual sampling time for the real model?)

This is possible, in two ways:

- with a little bit of low level programming:
you need to take the template you use for code generation, or the code generated, and then add at the beginning and end of the task calling the blocks (it was in dspic_main.c) an instruction to put an unused GPIO pin to 1 when the task starts, to 0 when it ends. Then attach the oscilloscope to the pin and see the duty cycle... if it is always 100% then it means the system is overloaded

- the simplest way:
if the system is overloaded, the task starts accumulating pending activations. Run the application in debug mode, and after a while stop it. if the EE_th_nact vector has values different from 0 then the system is overloaded...