Software Archive
Read-only legacy content
17061 Discussions

How to get Threads Stack utilization using Thread Inspector

Salvatore_Li_Mandri
405 Views
I would like to stress out my application like once I was able to do with TCHECK 3.1 + VTUNE

My application has grown so much in features + code and since I am running XP I am limited in memory I can use.
I though I could trim some fat off this way by reducing the stack I reserve for the threads execution

Can the inspector produce such report like TCHECK was able at the end of the run ?

Thanks
Sal
0 Kudos
1 Solution
Vladimir_T_Intel
Moderator
405 Views

Hi Vladimir + Peter,

This is a fragment of a real TCheck session: (Taken fromthe output Window - the one that lists my errors)

-----------
11 12 A thread died while owning a synch object A thread dies at [File_Name.exe, 0x9bb75] while owning a synch object Unknown

1314 Thread temination Thread termination at (File_Name.exe, 0xe84145) - includes stack allocation of 57.25 MB and use 4KB

Another thread, since it runs re-entrant code has a higherusage...
1415 Thread temination Thread temination at (File_Name.exe, 0x21bc70) - includes stask allocation of 57.25 MB and use 16 KB
----------------

Are the 4KB and the 16KB the stack usageto the nearest block size of 4KB ?
If not what are then, those values ?

Thanks
Sal
Hi Sal,

Yes, you were right. Thread Checker provides some information when the thread is being terminated.
The first number in the message is the number of bytes that were initially allocated to the stack of the thread. The second number is the number of bytes that were actually used during the thread's lifetime. Both values have been rounded-up to the nearest page size by the Windows operating system.
This is a "side effect" of tracing the thread information as TC retrieves it from the thread info. This might be a good feature for Inspector as well. However, for more detailed report of stack usage I'd recommend using MSFT debugger.

View solution in original post

0 Kudos
6 Replies
Peter_W_Intel
Employee
405 Views
I would like to stress out my application like once I was able to do with TCHECK 3.1 + VTUNE

My application has grown so much in features + code and since I am running XP I am limited in memory I can use.
I though I could trim some fat off this way by reducing the stack I reserve for the threads execution

Can the inspector produce such report like TCHECK was able at the end of the run ?

Thanks
Sal

Hi Sal,

Intel Thread Checker allows to use 600 MB (default) for its analysis engine, if your app is huge - you may enlarge this value; otherwise some errors will be missed since ThreadChecker deletes old statistics ifout ofmemoryreached.

Parallel Inspector hasno such mechanism to allow user to adjust memory use for product's engine.

Regards, Peter
0 Kudos
Salvatore_Li_Mandri
405 Views

Hi Sal,

Intel Thread Checker allows to use 600 MB (default) for its analysis engine, if your app is huge - you may enlarge this value; otherwise some errors will be missed since ThreadChecker deletes old statistics ifout ofmemoryreached.

Parallel Inspector hasno such mechanism to allow user to adjust memory use for product's engine.

Regards, Peter

Hi Peter,

I believe you missed what I was asking...

I would like to know for each thread that I created in my applicationhow much stack was consumed of the default 1 MB that each threadwas created with (defaut size unless you specify a value)

Thread Checker and VTune were able to report a value that I could use to avoid memory waste once I completed the program run.

To be safe I would usually double-up each value I was gettingand use that value in creating that thread in the release version of the program

Is such information made available at the user (somehow) after the Inspector has completed his run or I got to find that on my own my initializing the stack to a predefined pattern and inspect the thread stack before the thread is destroyed and report the findingssomewhere?

Thanks again
Sal
0 Kudos
Peter_W_Intel
Employee
405 Views

Hi Peter,

I believe you missed what I was asking...

I would like to know for each thread that I created in my applicationhow much stack was consumed of the default 1 MB that each threadwas created with (defaut size unless you specify a value)

Thread Checker and VTune were able to report a value that I could use to avoid memory waste once I completed the program run.

To be safe I would usually double-up each value I was gettingand use that value in creating that thread in the release version of the program

Is such information made available at the user (somehow) after the Inspector has completed his run or I got to find that on my own my initializing the stack to a predefined pattern and inspect the thread stack before the thread is destroyed and report the findingssomewhere?

Thanks again
Sal

Hi Sal,

Last time I just talked about memory consumption for product's engine.

I knew that you want to know memory consumption for each thread of user's application, andincreasevalue from default 1MB...

However I felt little confused - Intel? Thread Checker and VTune Analyzernever report memory patterm of application, what is the report you used?

Regards, Peter
0 Kudos
Vladimir_T_Intel
Moderator
405 Views

Thread Checker and VTune were able to report a value that I could use to avoid memory waste once I completed the program run.


Would you please be morespecificon how VTune was able to report that value?Franklyspeaking, I don't know how Thread Checker reported it as well.
0 Kudos
Salvatore_Li_Mandri
405 Views
Would you please be morespecificon how VTune was able to report that value?Franklyspeaking, I don't know how Thread Checker reported it as well.

Hi Vladimir + Peter,

This is a fragment of a real TCheck session: (Taken fromthe output Window - the one that lists my errors)

-----------
11 12 A thread died while owning a synch object A thread dies at [File_Name.exe, 0x9bb75] while owning a synch object Unknown

1314 Thread temination Thread termination at (File_Name.exe, 0xe84145) - includes stack allocation of 57.25 MB and use 4KB

Another thread, since it runs re-entrant code has a higherusage...
1415 Thread temination Thread temination at (File_Name.exe, 0x21bc70) - includes stask allocation of 57.25 MB and use 16 KB
----------------

Are the 4KB and the 16KB the stack usageto the nearest block size of 4KB ?
If not what are then, those values ?

Thanks
Sal
0 Kudos
Vladimir_T_Intel
Moderator
406 Views

Hi Vladimir + Peter,

This is a fragment of a real TCheck session: (Taken fromthe output Window - the one that lists my errors)

-----------
11 12 A thread died while owning a synch object A thread dies at [File_Name.exe, 0x9bb75] while owning a synch object Unknown

1314 Thread temination Thread termination at (File_Name.exe, 0xe84145) - includes stack allocation of 57.25 MB and use 4KB

Another thread, since it runs re-entrant code has a higherusage...
1415 Thread temination Thread temination at (File_Name.exe, 0x21bc70) - includes stask allocation of 57.25 MB and use 16 KB
----------------

Are the 4KB and the 16KB the stack usageto the nearest block size of 4KB ?
If not what are then, those values ?

Thanks
Sal
Hi Sal,

Yes, you were right. Thread Checker provides some information when the thread is being terminated.
The first number in the message is the number of bytes that were initially allocated to the stack of the thread. The second number is the number of bytes that were actually used during the thread's lifetime. Both values have been rounded-up to the nearest page size by the Windows operating system.
This is a "side effect" of tracing the thread information as TC retrieves it from the thread info. This might be a good feature for Inspector as well. However, for more detailed report of stack usage I'd recommend using MSFT debugger.
0 Kudos
Reply