This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: Idle thread exit ???hook???
- From: Andrew Lunn <andrew at lunn dot ch>
- To: panduroDk <spa at triax dot dk>
- Cc: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 13 May 2009 14:52:45 +0200
- Subject: Re: [ECOS] Idle thread exit ???hook???
- References: <23520977.post@talk.nabble.com>
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