In each class file, their is a code attribute associated with every method. In this code attribute is the max stack size used by that method. Theoretically you could instrument your code using BCEL to add/subtract this value at the start/end of each method to a grand total per thread.

See
4.7.3 The Code Attribute

   Code_attribute {
        u2 attribute_name_index;
        u4 attribute_length;
        u2 max_stack;
        u2 max_locals;
        u4 code_length;
        u1 code[code_length];
        u2 exception_table_length;
        {       u2 start_pc;
                u2 end_pc;
                u2  handler_pc;
                u2  catch_type;
        }       exception_table[exception_table_length];
        u2 attributes_count;
        attribute_info attributes[attributes_count];
   }

here

http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#43817


----- Original Message ----- From: "Marc Van Daele" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, September 06, 2006 5:39 AM
Subject: stack size


Hello,

Sorry if this turns out to be off topic but I want to monitor the current stack size of my Java Threads.
I wonder whether this is possible with BCEL?
Any other options?

Marc


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to