I would want to profile multithreaded program and find out if threre was a contention for mutex by threads.
If a thread is going to operate on some mutex, the thread needs to call corresponding pthread functions, like pthread_mutex_lock. I should be able to redirect the execution of these functions, as in wrap before and after the execution of these functions, where I can get the parameters and return values.
how to intercept calls to pthread_mutex_lock. doing something like #define pthread_mutex_lock my_pthread_mutex_lock?
Kindly throw some light on this.I request you to help me out.
Thank you in advance.
This doesn't have much to do with Intel, but you can Google for "symbol interposition" or something like that. One way is to use LD_LIBRARY_PRELOAD on Unix-like with a library that redefines the symbols. You can also look at uprobes and similar.