Stack 'Used' shown in Ranger/SysMon diffs

A forum for general AmigaOS 4.x support questions that are not platform-specific
User avatar
abalaban
Beta Tester
Beta Tester
Posts: 456
Joined: Mon Dec 20, 2010 2:09 pm
Location: France
Contact:

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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?
AmigaOne X1000 running AOS 4 beta
AmigaOne XE/G4
Amiga 1200/PPC 603e + BVision PPC
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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.
cheers
tony
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post by zzd10h »

Colin :
Thank you very much, I just sent you a PM.
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
zzd10h
Posts: 546
Joined: Sun Sep 16, 2012 6:40 am
Location: France

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post by zzd10h »

Many thanks to you, Colin, for your StackUse source.

Stack used is now reenabled for next SysMon update.
http://apps.amistore.net/zTools
X1000 - AmigaOS 4.1.6 / 4.1 FE
User avatar
OldFart
Posts: 104
Joined: Tue Jul 12, 2011 3:56 pm
Location: Groningen, Netherlands

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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
X5000, appears to be sick. Dismantled jan 1, 2024.
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
User avatar
colinw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 218
Joined: Mon Aug 15, 2011 10:20 am
Location: Brisbane, QLD. Australia.

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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.
User avatar
OldFart
Posts: 104
Joined: Tue Jul 12, 2011 3:56 pm
Location: Groningen, Netherlands

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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
X5000, appears to be sick. Dismantled jan 1, 2024.
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1483
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post 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.
cheers
tony
User avatar
OldFart
Posts: 104
Joined: Tue Jul 12, 2011 3:56 pm
Location: Groningen, Netherlands

Re: Stack 'Used' shown in Ranger/SysMon diffs

Post by OldFart »

@tonyw

Makes sense.

OldFart
X5000, appears to be sick. Dismantled jan 1, 2024.
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear, sitting idle.
RaspBerry Pi 2B, 3B, 4B/4Gb, 4B/8Gb
OrangePi 5+ 8Gb
ACER Windows 10
Post Reply