Pumpkin, Inc.

Pumpkin User Forums

time spent on a task......

For issues specific to Microchip's PICmicro® MCUs, including compilers (e.g. HI-TECH PICC & PICC-18, Microchip MPLAB®-C18) and IDEs (e.g. Microchip MPLAB®).

time spent on a task......

Postby kamyip » Tue Nov 09, 2004 5:56 am

Hi Andrew,

Currently I'm running 23 tasks and 18 binsem in my system. All is working fine. However, I need to know how approximately the time is being share between them and howmuch time that it is running idle. My timer is running at 10ms interval. Are there any trick that you have on your sleve to do that???

Over2u
kam

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: time spent on a task......

Postby aek » Tue Nov 09, 2004 10:34 am

Hi Kam.

You have LE, right?

Pro has some hooks that can be used to get runtime performance metrics. With LE, nothing pops into my head as a solution ...

Let me think about it some more. A Salvo for PICmicro(R) user (Luben C.) built some hardware that, when coupled with a small bit of code and Salvo Pro, is able to do stuff like show how much of the time the system is idling ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: time spent on a task......

Postby kamyip » Thu Nov 11, 2004 1:01 am

ok, i'll have to live with it for the time being and keep my finger cross.

btw, when is the next version going to be out. Maybe it's a good time for me to upgrade to "pro".

Cheers ... :-)

kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: time spent on a task......

Postby kamyip » Fri Nov 12, 2004 5:41 am

Thanks.... :-)
kamyip
 
Posts: 46
Joined: Mon Apr 15, 2002 11:00 pm

Re: time spent on a task......

Postby aek » Fri Nov 12, 2004 7:20 am

Hi Kam.

Hooks to the inside of OSSched() are required to accurately reflect the ratio of eligible task executions to idle hook calls. That's where Salvo Pro comes in handy ...

However, you can probably get a decent approximation doing something like this in your main():

code:
for (;;)
{
OSSched();
if (OSAnyEligibleTasks())
{
BIT = 1;
ctxCount++;
}
else
{
BIT = 0;
idleCount++;
}
}

With this setup, you can watch BIT with a scope or logic analyzer and from its average duty cycle infer the running/idle ratio. And you can also look at the ratio of ctxCount to idleCount ...

This setup will be biased towards the idle hook -- it will accurately report frequency of the idle task running, but will underreport the frequency of tasks executing (it has to do with how OSSched() works, and is complicated). But when Salvo Pro isn;t available, this is probably the best you can do.

Oh, another thing you can do is invoke sleep mode from OSIdlingHook((), and leave sleep mode from each ISR that has a call to a Salvo service. Set/clear bits those places, and that will give you an accurate reflection of the percentage of time that it's sleeping (and therefore idle).

Salvo v4 is coming out soon (ARM distribution is first). That might be a good time to upgrade to Pro ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to PICmicro MCUs

Who is online

Users browsing this forum: No registered users and 2 guests

cron