* Re: Stack, task size and DEC Ada [not found] <32FA17E0.7566@sema-grenoble.fr> @ 1997-02-07 0:00 ` Corey Ashford 1997-02-07 0:00 ` Mats Weber 1 sibling, 0 replies; 2+ messages in thread From: Corey Ashford @ 1997-02-07 0:00 UTC (permalink / raw) To: Axel Boness Axel Boness wrote: >> I am now desesperate because I can't find a formula that gives me the > stack used/free in function of the adress of my variable and the info > given by GET_TASK_INFO.GET_CURRENT_TASK_STACK_TOP and > GET_TASK_INFO.GET_CURRENT_TASK_STACK_BASE. Assuming the following: The stack grows downward from high addresses toward lower addresses. The stack top is the highest address the stack pointer will be at The stack base is the lowest address the stack pointer will be at (a.k.a. the stack limit) You could make a routine that starts searching memory upward from the stack base until it finds a non-zero word, or until it runs into the stack top, whichever comes first. It's virtually impossible that you'll ever hit the top because *some* space must be used, but it's just a backstop in case there's an error somewhere. Once you find the first non-zero word, that'll be the high-water mark. This assumes, of course, that stacks are zeroed out on task start-up. This is essentially the technique our debugger uses to display task stack usage. Hope this helps - Corey ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Stack, task size and DEC Ada [not found] <32FA17E0.7566@sema-grenoble.fr> 1997-02-07 0:00 ` Stack, task size and DEC Ada Corey Ashford @ 1997-02-07 0:00 ` Mats Weber 1 sibling, 0 replies; 2+ messages in thread From: Mats Weber @ 1997-02-07 0:00 UTC (permalink / raw) > There is, in the predefined units, a GET_TASK_INFO unit that permits a > direct access to internal task information. It's thus possible to > dynamically get the task type name, task id, ... and, most of all, a few > parameters that seem to be interesting : the task stack top and base. > > I thought to myself with these functions I'll be able to write a small > routine that declares a (small) variable, I'll take the adress of this > variable and compare it to either the top or the base of the stack and > I'll know (nearly) how much of the stack of my task is currently used. > It was great I could with this little probe evaluate (roughly) the stack > used in particular places in my program. You probably don't need this in your code once it is in production. While you are developping, you can use the VMS Ada debugger to look at how much stack space each task has consumed and then do the necessary adjustments. The useful commands are: <<first set a breakpoint at a point before all the tasks go away>> dbg> sho task/all -- shows the list of all tasks dbg> sho task/full %task<number> -- shows info (including stack) about a task --Mats ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-02-07 0:00 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <32FA17E0.7566@sema-grenoble.fr> 1997-02-07 0:00 ` Stack, task size and DEC Ada Corey Ashford 1997-02-07 0:00 ` Mats Weber
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox