Page 2 of 2
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Fri Jun 27, 2014 12:30 pm
by abalaban
Colin:
Unless the stack is restore back to 0 after it is not used anymore, wouldn't that method indicate how much stack the task has been using *at some point* instead of the current usage?
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Fri Jun 27, 2014 3:52 pm
by tonyw
Of course - but the current stack pointer is of little interest to anyone, anyway. At the time that it is measured (by a different program), it could be anything. What you usually want to know is the maximum stack depth it has reached in the past.
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Fri Jun 27, 2014 8:42 pm
by zzd10h
Colin :
Thank you very much, I just sent you a PM.
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Mon Jul 07, 2014 9:34 am
by zzd10h
Many thanks to you, Colin, for your StackUse source.
Stack used is now reenabled for next SysMon update.
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Wed Jul 09, 2014 3:54 pm
by OldFart
If I remember correctly, I used to fill the entire stack from the unused side upto the stackpointer with uint32's containing 0xDEADBEEF. When the program has finished it is a matter of measuring the heap of dead beef that remains. Can't tell you the exact specs as my Micro is out of order since a year and a half.
OldFart
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Thu Jul 10, 2014 12:22 am
by colinw
OldFart wrote:If I remember correctly, I used to fill the entire stack from the unused side upto the stackpointer with uint32's containing 0xDEADBEEF. When the program has finished it is a matter of measuring the heap of dead beef that remains. Can't tell you the exact specs as my Micro is out of order since a year and a half.
OldFart
Yeah, I know this was done, I found it in a couple of old programs.
The only question I have is why, what was wrong with the default cleared stack memory value of zero. ?
A pushed return address can't ever be zero, but there's no guarantee it can't be some other arbitrary value.
It also complicates the stack testing code because it has to have a test for cookie mungers as well as for the default zero values.
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Thu Jul 10, 2014 11:41 am
by OldFart
@colinw
Another way *MIGHT* be to find the programs Task structure and on a continuous base check the value of its stackpointer, thereby remembering the highest value reached. Ouch, all sorts of statistics could be gotten from this. Hm, I really need an Amiga soonish to sort this kind of thing out. I got that TaskView proggy somewhere on my dead Micro's HD. Might be a nice addition.
OldFart
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Thu Jul 10, 2014 1:00 pm
by tonyw
But the stack pointer in the Task struct is only updated when the task is suspended/checkpointed/waits for I/O or a signal. In between those times, it may have called a recursive function 1058 times.
The saved stack pointer is really of use only to the Exec, so that it can restore the task to a running state at some time in the future.
Re: Stack 'Used' shown in Ranger/SysMon diffs
Posted: Fri Jul 11, 2014 10:31 am
by OldFart
@tonyw
Makes sense.
OldFart