Author Topic: Processor Utilization  (Read 10661 times)

Offline dkg

  • Newbie
  • *
  • Posts: 48
    • View Profile
Processor Utilization
« on: November 23, 2009, 04:45:34 PM »
Hi Mark,

Have you thought at all on how to measure processor utilization with uTasker? Basically, it would be really useful to know what percent of time is spent waiting for tasks to run.

Dave G.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Processor Utilization
« Reply #1 on: November 23, 2009, 05:57:17 PM »
Hi Dave

One useful method is to activate SUPPORT_LOW_POWER in config.h and also define an output to MEASURE_LOW_POWER_ON() and MEASURE_LOW_POWER_OFF() [these are called in the fnLowPower() task and defined in app_hw_xxxx.h].

By monitoring the output you can see when the processor is sleeping and when it is working due to scheduling in progress.

Although it is seen when the scheduling runs due to interrupts, the actual interrupts are not visible. By adding other outputs in individual IRQs, or by using a code on several port bits it is then possible to monitor exactly when the CPU was scheduling, handling interrupts within a certain period of time. A logical analyser can capture this over this period and allow accurate analysis of the load and any critically long individual interrupt routines.

Regards

Mark

Offline dkg

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: Processor Utilization
« Reply #2 on: November 23, 2009, 07:05:16 PM »
Hi Mark,

I was thinking of code that maybe used a hardware timer in a background task or the scheduler that would allow us to watch processor utilization programmatically in the field. I haven't thought this out completely but I have seen something similar done on RTOS's.

Dave G.

Offline Unmesh

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Processor Utilization
« Reply #3 on: September 10, 2011, 08:56:44 AM »
Hi mark,
                The Low Power Task putting the CPU in a normal sleep mode by calling the function__sleep_mode();   
How can we put into "Deep Sleep Mode"?

Thanks & Regards
Unmesh

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Processor Utilization
« Reply #4 on: September 10, 2011, 12:07:03 PM »
Hi Unmesh

The low power task uses the sleep mode, which stops just the processor core from operating and is woken whenever there is an interrupt (usually with virtually no delay). In some instances some peripherals may also be disabled to save extra power but often peripheralsa operate without and restrictions.

What other low power modes are possible depends on the chip used. Deep sleep modes probably disable also (most) peripherlas and can be woken via asynchronous interrupts (like a an IRQ line). Some such very low power modes can also only be woken by a reset! Wake up time may be slow if oscillators are also stopped during the process deep sleep mode.

Since the deep sleep modes are so sifferent and usually the processor can not actually be used for anything useful during this period (apart from saving the state of memory so that it may be able to continue some time later) it is probably not possible to devise a generic solution to do it. Therefore lower power modes will probably need to be controlled by application level code which decides the depth of sleep that is possible, depending on wake-up capability, delays and current consumption that is acceptable.

This means that you will need to first decide which of the deep sleep modes (for your processor) is best suited to the application's requirements and then enter the mode according to the details in the data sheet. How the mode is subsequently exited may need to be configured too.

Regards

Mark