| Last Modified On : | September 30, 2009 7:12 AM PDT |
Rate |
|
Intel® Parallel Amplifier provides a call stack for functions in the results view. For some applications these call stacks might appear incomplete or seem incorrect according to known application work flow, even with .pdb files for the project binaries. Additionally, there could be '[Unknown]' identifiers within the function call chain displayed in the stack view. Generally, the problem appears when there is difficulty defining the call path to the user code because of system functions on top of the stack.
See the illustrative Hotspot results of analysis the multithreaded test case below. Here are several run-time functions (called in ntdll.dll) on the top of the list. It is not clear from the Call Stack View or Top-Down Tree to which user functions those calls are descending though the stack. Additionally, there are ‘Unknown’ identifiers which refer to function and module names.
Let’s study the source code of the analyzed application. The ExtendBuffer function is extending a buffer chain by allocating some memory for a new node in the linked list of buffers. ExtendBuffer is supposed to take most of the program execution time as it's being called in the loop within many threads and there are no other functions that do enough calculations to consume noticeable CPU time.
#define THREAD_NUM 16
struct chain
{
size_t size;
char* buf;
chain* p_c;
};
chain* ExtendBuffer(chain* p, size_t n)
{
chain* p_new = new chain;
p_new->p_c = 0;
p_new->size = n;
p_new->buf = new char[n];
p->p_c = p_new;
return p_new;
}
DWORD WINAPI TestFunc(LPVOID param)
{
chain* p = new chain;
for (int i=0;i<10000;i++)
p = ExtendBuffer(p, 4);
return 0;
}
void main()
{
DWORD idThread[THREAD_NUM];
HANDLE hThread[THREAD_NUM];
for(int i=0;i<THREAD_NUM;i++)
hThread[i]=CreateThread(NULL,0,TestFunc,0,0,&idThread[i]);
WaitForMultipleObjects(THREAD_NUM,hThread,TRUE,INFINITE);
}
Getting back to the Hotspot results there is no ExtendBuffer function in the list. If searching for the known user functions (e.g. ExtendBuffer or TestFunc), they might be found under '[Unknown frame(s)]' function identifier in the stack and the attributed CPU time is not that high as expected, which is confusing.
Specify paths to the Microsoft* symbol server in the Microsoft Visual Studio*, for example, http://msdl.microsoft.com/download/symbols, in Tools > Options > Debugging > Symbols page.
For more information regarding the Microsoft Symbol Server, please see http://www.microsoft.com/whdc/devtools/debugging/debugstart.mspx
Intel® Parallel Amplifier will use the symbol files cached in the C:\websymbols directory, as it is set in the example, and provide a more complete call stack:
Now the source lines are resolved properly and with a double click onto the hotspot function a user will be navigated to the right source code:

English | 中文 | Русский | Français
Vladimir Tsymbal (Intel)
|