Idle thread exit ‘hook’

View: New views
3 Messages — Rating Filter:   Alert me  

Idle thread exit ‘hook’

by panduroDk :: Rate this Message:

| View Threaded | Show Only this Message

Hi

I’m trying to measure my CPU load by using a GPIO pin and a voltmeter, and now I’m looking for some kind of Idle thread exit ‘hook’ but I can’t seem to find it, dose eCos provide such a functionality. The plan Is to set the GPIO high in the idle thread, and set low when exited the idle thread.

I hope you can tell me where to locate the ‘hook’ or a nother way to do it.

Thanks and best regards.
Søren P

Re: Idle thread exit ???hook???

by Andrew Lunn-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Wed, May 13, 2009 at 05:40:56AM -0700, panduroDk wrote:
>
> Hi
>
> I???m trying to measure my CPU load by using a GPIO pin and a voltmeter, and
> now I???m looking for some kind of Idle thread exit ???hook??? but I can???t seem to
> find it, dose eCos provide such a functionality. The plan Is to set the GPIO
> high in the idle thread, and set low when exited the idle thread.

Sorry, it does not work this way. The idle thread is a normal thread,
but with very, very low priority. Its low priority means it gets
preempted when there is a higher priority thread which is runable. It
is not entered and exited.

Probably the best you can do is replace the idle thread with your own
thread which modulates a GPIO. That is it toggles it endlessly
high/low/high/low. When it is toggling you know the CPU is idle. When
it is steady state, it is busy.

What you might also find interesting is packages/services/cpuload

     Andrew

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Re: Idle thread exit ???hook???

by Edgar Grimberg-3 :: Rate this Message:

| View Threaded | Show Only this Message


> What you might also find interesting is packages/services/cpuload
>  

Further more, if you want to find out what's consuming the CPU cycles,
you can take a look at gprof support:

http://ecos.sourceware.org/docs-latest/ref/gprof.html

Regards,
Edgar


--
Edgar Grimberg
System Developer
Zylin AS
ZY1000 JTAG Debugger http://www.zylin.com/zy1000.html
Phone: (+47) 51 63 25 00


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss