Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Marc_Amstoutz
Beginner
60 Views

user API vs collection type

Hello,

I'm trying to use user API and observed the following under linux version of amplxe :

threadNaming, frame and events seems only effective for user mode sampling collections.

Moreover, thread naming only shows half of the threads when duration-type is greater than veryshort.

The threads are sharing the same code (worker threads).

Are there some limitation for using user API ?

regards,
Marc
0 Kudos
4 Replies
Peter_W_Intel
Employee
60 Views

Usually VTune Amplifier will show entry function name as thread_name, but you can set thread name by yourself - use ittnotify API. Here is example:

Compile example file - itt_set_thread_name.cpp:
# g++ -g itt_set_thread_name.cpp /opt/intel/vtune_amplifier_xe_2011/lib64/libittnotify.a -o itt_set_thread_name.g++ -lpthread ldl

[cpp]#include 
#include 
#include 
#include "/opt/intel/vtune_amplifier_xe_2011/include/ittnotify.h"

#define NUMTHREADS 16
void *helloFunc(void *pArg)
{
   int curthread = *(int *)pArg;

   if (curthread==11) /* Want to monitor interest of thread */
        __itt_thread_set_name("Thread 12");

   for (unsigned long i=0; i<0x8000000; i++);
   printf("Hello Thread %dn",curthread);

   return 0;
}

main()
{
   pthread_t hThread[NUMTHREADS];
   int i, j, threadNo[NUMTHREADS];

   for (i = 0; i < NUMTHREADS; i++)     {
       threadNo = i;
       pthread_create(&hThread, NULL, helloFunc, &threadNo);
   }

   for (j = 0; j < NUMTHREADS; j++)
       pthread_join(hThread, NULL);

   return 0;
}
[/cpp]
Marc_Amstoutz
Beginner
60 Views

Hi Peter,
thanks for your answer.
Actually I used the API as you suggested but had it partially working.
My point was about this partial result :
- not working with Event Based Sampling (i.e. lightweight-hotspots)
- partially working with User Mode Sampling (needs -duration-type very-short)
My question is then : is there a limitation od the user API regarding the collection configuration ?
Regards,
Marc
Marc_Amstoutz
Beginner
60 Views

Hi Peter,
I managed to have thread names with Event Based Sampling (i.e. lightweight-hotspots), but nor event.
With user mode sampling, the events shows up (using windows version), but I have a question : I have created two events, and wondered how to see event names within the "Bottom Up" panel of the gui.
Thanks,
Marc
Peter_W_Intel
Employee
60 Views

If you want to see your events in report, please refer to ittnotify.h & online helper.

Here is my blog to educate how to mark user's tasks in timeline of the report (Sorry for Chinese version, butexample code can be referenced)

Regards, Peter

Reply