This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stack_used() not accurate?


On Thu, May 29, 2008 at 10:48 AM, Frank Ch. Eigler <fche@redhat.com> wrote:
> Wenji Huang <wenji.huang@oracle.com> writes:
>
>> [...]  I did a test and found it kept the constant value.
>
> If the kernel switches to a separate stack for int3 handling, that
> could explain the constant value.

Thanks for the explanation.

>> function stack_used_new:long() %{ /*pure */
>>  {
>>          unsigned long *n = end_of_stack(current);
>>          unsigned long free;
>>          while (*n == 0)
>>                  n++;
>>          free = (unsigned long)n - (unsigned long)end_of_stack(current);
>>          THIS->__retvalue = THREAD_SIZE - free;
>> }
>> %}
>
> This searching for non-0 values seems dangerously unbounded.  Plus it
> may measure the *maximum historical* rather current stack usage.

Yes, when using Wenji's stack_used_new() I'm seeing free=0 quite
frequently; obviously that isn't useful/accurate.

I'll be exploring other implementations, but any suggestions would be
very welcome.

Mike


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]