|
Andreas Polychronopoulos
02/28/2009 8:30 AM
post23159
|
Hi everybody,
I am trying to measure the time a mutex take to lock and unlock , here is my code
*****************************************************
void *functionA();
int main(int argc, char *argv[]) {
/* initialize mutex1 */
pthread_mutex_init(&mutex1, NULL);
/* create threads */
pthread_create(&tid_A, NULL, &functionA ,NULL);
/* 2 secs sleep */
sleep(2);
}
void *functionA(){
pthread_mutex_lock(&mutex1);
pthread_mutex_unlock(&mutex1);
}
*******************************************************
I build the application with the IDE and at Build Options i choosed , build for profiling (Function Instrumentation)
Then i create a new run configuration for the _g binary adding the appropriate Application Profiler tool on Tools bar of
the Open Run dialog.
I can get results for the function main and functionA but not for pthread_mutex_lock,pthread_mutex_unlock. Is it
possible to get the time for each line of code ?
The Functon Instrumentation mode is good for single thread application what about add more threads on the above code ?
Will i get correct results or should i do a different profile ?
thanks
|
|
|
|
|