Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
131 user(s) are online (122 user(s) are browsing Forums)

Members: 1
Guests: 130

K-L, more...

Support us!

Headlines

 
  Register To Post  

Some questions about stack.
Home away from home
Home away from home


See User information
Question #1:

What i need is to know, is how much of stack size exactly programm use on running. I know there is stack cookies, i know that there is stack command, and i know that workbench have some default stack size, but what i need its something more low-level, which can show how much stack exactly my binary takes.

Like some window, where is list of binaries, and on which i can see how much stack size it takes on running.

Maybe it possible to see via ranger or snoopy or kind ?

Question #2:

Is stackcookie supposed to work with something like this:

Quote:

static const char * __attribute__((used)) stackcookie = "$STACK: 2*1024*1024"


What i mean there is that "2*1024*1024" will calculate the size normally or not ? Seems when i use just 2097152 , then all is ok, but if use it like 2*1024*1024 then its seems like stack size sets as very small one, and not calculates as 2097152.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Some questions about stack.
Quite a regular
Quite a regular


See User information
I don't know for sure but I doubt DOS will evaluate the cookie stack string and do the calculus.
Maybe you can use preprocessor stringification operator.

EDIT: oh and for #1 you can calculate by yourself the maximum stack size a program will take. All other methods will be the *observed* maximum on a given session using a given set of data, which might or might not be the real theoretical maximum.

Back to a quiet home... At last
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@abalaban
Quote:

I don't know for sure but I doubt DOS will evaluate the cookie stack string and do the calculus.
Maybe you can use preprocessor stringification operator.

Seems that its indeed didn't calculates when i write it like this.

Quote:

EDIT: oh and for #1 you can calculate by yourself the maximum stack size a program will take. All other methods will be the *observed* maximum on a given session using a given set of data, which might or might not be the real theoretical maximum.


mm.. the point of that question, is because of the first question as well : i.e., i write a stackcookie which should calculate, but it didn't, or did, but in some manner. So, i just want to see how much of stack space my binary set after running. 2, or 2*1024, or its like 2something1024something1024, or just nothing.

Pure technical interest. I.e. not how much i need, but how much my cookie set exactly when i write some trash in it, and how it reacts.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Some questions about stack.
Quite a regular
Quite a regular


See User information
Hello,

In case you talk about a tool for monitoring the stack; I have allways appreciated this one, and work on AOS4.

http://aminet.net/dev/moni/StackSnoop.lha

this tool monitor the stack, remember the largert one and update in realtime the stack used during the use of the program monitored.

A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT
SAM440EP on Mapower 3000+AOS4.1

Amiga Docs Disk Preservation Project
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@Mrodfr
Quote:

In case you talk about a tool for monitoring the stack; I have allways appreciated this one, and work on AOS4.

http://aminet.net/dev/moni/StackSnoop.lha


Thanks ! Thats exactly what i asked for ! Super tool: tiny, small, show how much stack allocated by which task/process, can update list in realtime, can save the content of stack to the file and so on and so on. True amiga stuff :) Something like this will be good to have in native. I do not know if it worth to try to contact with author after 13 years since his latest release of it, but why not try..

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@kasie
If it would help, I can provide some code to show the current & total stack size of the program itself?

Author of the PortablE programming language.
Go to top
Re: Some questions about stack.
Quite a regular
Quite a regular


See User information
Quote:

kas1e wrote:
mm.. the point of that question, is because of the first question as well : i.e., i write a stackcookie which should calculate, but it didn't, or did, but in some manner. So, i just want to see how much of stack space my binary set after running. 2, or 2*1024, or its like 2something1024something1024, or just nothing.

Pure technical interest. I.e. not how much i need, but how much my cookie set exactly when i write some trash in it, and how it reacts.


My guess would be that in case the stack cookie can not be interpreted it would stay at the configured system default value.

I was just emphasizing that unless you are using recursion the maximum stack usage can be calculated. All other method is just an approximation based on observation of a run. The result may or may not be accurate and more importantly may not be enough.

Back to a quiet home... At last
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
Quote:

kas1e wrote:
Question #2:

Is stackcookie supposed to work with something like this:

Quote:

static const char * __attribute__((used)) stackcookie = "$STACK: 2*1024*1024"


What i mean there is that "2*1024*1024" will calculate the size normally or not ? Seems when i use just 2097152 , then all is ok, but if use it like 2*1024*1024 then its seems like stack size sets as very small one, and not calculates as 2097152.


If you want to write the stack size as 2 * 1024 * 1024 in your source-code, then try something like this:

#define STR_EXPAND(tok) #tok
#define STR(tok) STR_EXPAND(tok)

static const char *  __attribute__((used)) stackcookie "$STACK: " STR(1024 1024);


The compiler's MACRO preprocessor will do the calculation and convert it to a string.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@CrhisH
Quote:

If it would help, I can provide some code to show the current & total stack size of the program itself?

Better if you can write on portable the same StackSnoop :) I assume should be more or less easy for you as you have gui module already + stack related code.


@Hanz
Thanks !

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Some questions about stack.
Just popping in
Just popping in


See User information
The stack cookie usage documentation can be found in
the IDOS->FindSegmentStackSize() autodoc.

The cookie for 25K must be like this;
USED CONST TEXT cookie[] = "$STACK:25000";

Steven Solie's "Ranger" tool has the info in the
[DOS]->[Process]->Stack line.



Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@kas1e Quote:
Better if you can write on portable the same StackSnoop :) I assume should be more or less easy for you as you have gui module already + stack related code.

Code for reading the stack of other tasks is not as accurate as that for reading for your own program... but I thought your suggestion might be a nice "little" GUI example for PortablE, so I did it anyway:

http://cshandley.co.uk/temp/Stacker.lha
http://cshandley.co.uk/temp/Stacker.e (source code)
Resized Image
EDIT: Recompiled & uploaded again, after fixing ugly background to text boxes.

It's NOT a clone of StackSnoop, but with a bit of work it could be made into one... (It's pretty close already)

BTW, PortablE's GUI Lists aren't anywhere near finished yet, so Stacker's GUI is a bit kludgy, but it does work.


Edited by ChrisH on 2012/5/15 19:06:14
Author of the PortablE programming language.
Go to top
Re: Some questions about stack.
Quite a regular
Quite a regular


See User information
ChrisH

Thanks for this first version.

Please add a max stack used column. Like that, user can monitor the stack program in the background and later know the max stack used by the program.

stacksnoop do that with a vue meter per program and updated realtime.

A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT
SAM440EP on Mapower 3000+AOS4.1

Amiga Docs Disk Preservation Project
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@CrhisH
Woah, its already good !

But yep, gui feels a bit kludgy. All works, but just some bits here and here.

Imho its already worth of uploading to os4depot (which didn't have Development/Monitors). But maybe because of your programm it can be added. Will be bad to put it to other areas, as its for sure monitor, and for sure pretty usable and intersting already. All that RMB menus as in stacksnoop and co, can be or can be not added (if you have time , will be nice), but even in current form it do the work, looks and feels native, loads fast and size not very fat one (but still 0.5mb, and by strip i can't reduce it).

Is it easy via portable add RMB menu ? Just after i see the code, i found portable pretty good middle line of the easy programming (in compare with C/C++), and still a decent language which allow you to go deep to the system. It is possible to use hooks in portable to extend some components by users ?

Anyway, thanks, already in my work:devs/moni/

ps. Btw, found a good difference in compare with StackSnoop: mouse wheel works in Stacker. But found also and a bit bad moment: when you run something from shell, and refresh the list, in lists its still shown like "shell process", while for example in stacksnoop, when you run something from shell, it will show in list "shell process: <name of bin>". So its kind of easy to detect.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@kas1e Quote:
Imho its already worth of uploading to os4depot

Naah. IMHO it is just a proof-of-concept toy. It needs a bit of work to be really useful (especially the requested "max stack usage" monitoring).

Quote:
Is it easy via portable add RMB menu ?

Yes & no. I have my own private module which makes menus very easy (and you can see it in action in RunInUAE & especially PictureAlbum), but this has not yet been turned into something I wish to make publically available.

Quote:
when you run something from shell, and refresh the list, in lists its still shown like "shell process"

Yes, that is another obvious improvement.

Quote:
loads fast and size not very fat one

Well, executable size is not (currently) one of PortablE's strong points, but it's not so bad that I'm in any hurry to improve it either...

Author of the PortablE programming language.
Go to top
Re: Some questions about stack.
Home away from home
Home away from home


See User information
@ChrisH
Sure, its need some love of course, but its really nice one and just deserve to be even in SDK once it will be polished. Such a nice/small but helpfull utilities should't die in the dust of forum posts.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project