Author Topic: Processor Utilization  (Read 7528 times)

Offline dkg

  • Newbie
  • *
  • Posts: 48
    • View Profile
Processor Utilization
« on: November 22, 2010, 03:26:22 PM »
I was wondering if anyone has added any code to uTasker to measure processor utilization on the Coldfire. Before adding yet another big chunk of code to our application, I am concerned it may be running out of horsepower on the Coldfire. I guess one way to measure it is to see how much time is spent (using a hardware timer?) in the scheduler waiting for a task to run.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3237
    • View Profile
    • uTasker
Re: Processor Utilization
« Reply #1 on: November 23, 2010, 03:35:37 PM »
Hi Dave

What I do is activate the low power task (#define SUPPORT_LOW_POWER).

This then sets the processor to sleep mode when there is no work to be done - it is woken from this mode at every interrupt and then schedules tasks until there is nothing more to be done again.

There is an output (via define) which is set and cleared dependingly and so, when this is monitored using a scope (or logic analyser), one can see how much of the processor's time is spent doing work and how much is waiting. The workload however depends also on external events/triggers and so there may be periods of low activity and then periods of continuous work - in the period of high activity the question is then whether all jobs that need to be done can be achieved in the required time. The total amount of time can usually be seen quite well since it appears as a longer burst of activity.

Regards

Mark

Offline dkg

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: Processor Utilization
« Reply #2 on: November 23, 2010, 04:23:04 PM »
Hi Mark,

Thanks for the suggestion. That will certainly work for what I need to determine at the moment.

There is also a desire to be able to get this type of information from the unit in the field for diagnostic purposes. I would guess I need a gated hardware timer to measure the time in one mode and average it over some period.

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3237
    • View Profile
    • uTasker
Re: Processor Utilization
« Reply #3 on: November 23, 2010, 06:21:30 PM »
Hi Dave

The method is quite good for getting a quick idea in the lab.

Of course, if it needs to be automated it will need a bit of additional code and a hardware timer for the counting/measuring of time - whether you use the sleep mode or no is probably not that important but the use of the checks to see whether there is work waiting or not is probably needed. If you have a timer measuring the idle and active periods you can then keep a peak value and possibly an average value for remote monitoring use.

Regards

Mark