This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Adjusting stack sizes



It sounds like you want the functions defined in
<cyg/kernel/test/stackmon.h>.

This function is very helpful when tuning stack sizes:
cyg_test_dump_thread_stack_stats( char *comment, Cyg_Thread *p );

Run your thread at it's highest possible stack usage, use this function
as a test diagnostic, and trim down near that.  And be careful...  If
you cut back the stack too far, you'll likely overflow your stack and
get very unpredictable bugs which are painful to track down.

-Dan

*
* Dan Bolstad
* Software Engineer, Interactive Objects
* danb@iobjects.com         425.289.0327
* 

-----Original Message-----
From: Rafael Rodríguez Velilla [mailto:rrv@tid.es]
Sent: Thursday, August 30, 2001 1:53 AM
To: ecos
Subject: Re: [ECOS] Adjusting stack sizes


"Simpkins, Andy" wrote:

> I assume that you mean whilst the thread is active?  I am not sure
that that
> can be done (simply)...
>
> However if you mean before you create the thread (which I am sure you
don't)
> then the stack size is specified as part of cyg_thread_create

   I don't want to create a thread that adjusts its stack size at run
time. I
want to create applications with threads that don't use too much thread
stack
space, so I'd want to know how do the others calculate the space
required by a
thread.

  I have seen a member "stack_limit" and two methods
"increment_stack_limit"
and "get_stack_limit" in the Cyg_Thread class that I think that are
supposed to
help the developers adjust their stacks doing some kind of run-time
simulation... but I don't know how to use that.



--
Rafael Rodríguez Velilla        rrv@tid.es
Telefónica I+D          http://www.tid.es
Telf: +34 - 91 337 4270




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]