09-16-2005
Profiling..entry for a function in pthread_create
Hi jim,
Thanks a lot for ur reply....
I have tried using gprof, FncCheck, SunWorkShop Pro, gprof does not give results thread wise, SunWorkShop is an excellent profiling tool, but since it is avaiable for Solaris platform i am try to find tool that can be used on other m/s also.
i had downloaded the code for profiling pv_trace (Author:= M. Tim Jones), and added modifications for multithreading and shared libraries.
i have made few modifications to the instrument.c code,
eg: As shown below.....
what i wanted is to profile for speicific functions, so what did is specify those functions as an environment variable and had them exported, in the instrument.c i read for that environment variable and populated list of functon entries in a hash table.
Now the problem is for functions calls from shared libraries. The ( *this ) parameter of "__cyg_profile_func_enter" points to some different addr.
eg:
my shared lbrary libMyThread.so on doing an "nm" gives
Addr mangled name demangled name
0x000010cc T EntryPoint__8MyThreadPv MyThread::EntryPoint(void *)
but on call to "MyThread::EntryPoint" the addr is "0xff3510cc"
This is because the linker is resolves entries to such functions at run time, i tried to use dlopen, dlsym functions but how to i get information of mangled functions corresponding to such address (in this case 0xff3510cc),
Also, when casting (*this) as int is gives a negative value(in this case 0xff3510cc). plz help...
Desc.:
checkProfileFlag() := This function tell whether to profile for all functions or
user specified functions.
DEBUG:= Macro for outputting debuggng info.
hx_search():= This is a function form "hash.c" which looks whether the
function needs to be proifiled or not.(Only useful when
functions are exported as env. variables.)
void __cyg_profile_func_enter( void *this, void *callsite )
{
if(DEBUG)
printf("E%p, %d,\n",(int*)this,abs((int*)this));
if(!checkProfileFlag()) {
if(hx_search((int *)this)){
if(DEBUG) {
printf("Profiling for %d, %p,\n",(int *)this,(int *)this);
printf("E%d,J%d\n",pthread_self(),pM[pthread_self()].size);
}
pM[pthread_self()].pth=getpid();
pM[pthread_self()].th=pthread_self();
pM[pthread_self()].fnc[pM[pthread_self()].size].addr=(int*)this;
pM[pthread_self()].fnc[pM[pthread_self()].size].Ch='E';
gettimeofday(&pM[pthread_self()].fnc[pM[pthread_self()].size].tp,NULL);
pM[pthread_self()].size++;
}
} else {
pM[pthread_self()].pth=getpid();
pM[pthread_self()].th=pthread_self();
pM[pthread_self()].fnc[pM[pthread_self()].size].addr=(int*)this;
pM[pthread_self()].fnc[pM[pthread_self()].size].Ch='E';
gettimeofday(&pM[pthread_self()].fnc[pM[pthread_self()].size].tp,NULL);
pM[pthread_self()].size++;
}
}
Last edited by Vikky Panchal; 09-16-2005 at 01:47 AM..
7 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I compiled my device driver with the profiling option -p but while linking I am getting undefined reference to _mcount.
LD /vobs/femto_drivers/DspBiosLink/dsplinkk/src/dsplinkk.o
Building modules, stage 2.
MODPOST
*** Warning: "_mcount" undefined!
Architechture: ppc32
From... (0 Replies)
Discussion started by: Ashok V
0 Replies
2. UNIX for Dummies Questions & Answers
question goes like this :
Explain how users can profile execution of a process with help of an example?
can some one pls give me the answer?? (1 Reply)
Discussion started by: rakesh1988
1 Replies
3. Programming
The prototype for pthread_create function is like this:-
int pthread_create(pthread_t *thread,pthread_attr_t *attr,void *(*start routine),void *arg);
Q.1 .Why the return type of the start_routine must be void*??
Q.2. Why should we pass arg by converting into void * only ??
Thank You (3 Replies)
Discussion started by: sunil_abhay
3 Replies
4. Programming
The SCO OSR 5.7 system was migrated from older HP DL360 to new DL380 G7. The SMP feature was not activated on older box, it is activated now on this 4 core Xeon.
A s/w we maintain has been copied without any change over to the new box. I noticed that the application profiling does not show any... (4 Replies)
Discussion started by: migurus
4 Replies
5. AIX
Hello everybody,
Please let me know if there are any free C profiling tool for AIX environment
Thanks in advance (0 Replies)
Discussion started by: SteAlma
0 Replies
6. How to Post in the The UNIX and Linux Forums
Hi All,
Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries.
example:
Parent is :
----------
dn: email=yogesh.kumar@wipro.com, o=wipro, o=in
child is:
----------
dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies
7. Debian
I was wondering how can I find the culprit of a slow shutdown on my debian box? I am actually looking for a diagnosis tool that might dump the process name and amount of time it took to close the process after signal was send.
As for now I am trying to use journalctl to seek some information,... (5 Replies)
Discussion started by: Varun Pandey
5 Replies
LEARN ABOUT DEBIAN
lm-profiler.conf
LM-PROFILER.CONF(8) System Manager's Manual LM-PROFILER.CONF(8)
NAME
/etc/laptop-mode/lm-profiler.conf - Configuration file for lm-profiler, a profiler for laptop-mode-tools.
DESCRIPTION
This manual page documents the options that can be set in the /etc/laptop-mode/lm-profiler.conf configuration file. For a description of
what lm-profiler does, see the lm-profiler(8) manpage.
SETTINGS
The syntax of options is OPTION=value.
The following settings are available in lm-profiler.conf:
VERBOSE_OUTPUT
Set this to 1 if you want to see a lot of output when you run lm-profiler, and 0 if you don't want this. Useful for debugging
purposes. (Currently does nothing.)
PROFILE_RUN_LENGTH
The length of a profiling run, in seconds. This should be a while, so that lm-profiler can gather enough information. The default
is 10 minutes (600 seconds).
ACTIVITY_INTERVAL_MIN
ACTIVITY_INTERVAL_MAX
The behaviour that you want to avoid when you have your hard drive spun down, is disk accesses that are spread out over time,
because your hard drive will have to spin up for each access. lm-profiler detects when applications perform disk accesses that
are at least some time apart (otherwise they can be considered part of the same access) but not TOO far apart (otherwise they are
no problem). These settings configure what lm-profiler considers "at least some time apart" and "too far apart", respectively, in
seconds.
RECOMMEND_DEFAULT_SERVICES
DEFAULT_SERVICES
If RECOMMEND_DEFAULT_SERVICES is set to 1 (enabled), then lm-profiler will always suggest turning off the services listed in
DEFAULT_SERVICES (separated by spaces).
IGNORE_PROGRAMS
Programs listed in this option, separated by spaces, will be ignored for disk activity profiling. The default settings (which can
be referenced as $DEF_IGNORE_PROGRAMS) include common utility programs and all programs used by lm-profiler itself.
RECOMMEND_NETWORK_SERVICES
When this option is enabled (value 1), lm-profiler will detect any services that are listening on network ports, and it will sug-
gest that you disable them.
IGNORE_NETWORK_SERVICES
Services listed in this configuration option (separated by spaces) are not suggested as a network service by lm-profiler. The
default values can be accessed as $DEF_IGNORE_NETWORK_SERVICES.
SEE ALSO
lm-profiler(8).
laptop_mode(8).
laptop-mode.conf(8).
AUTHOR
This manual page was written by Bart Samwel (bart@samwel.tk). Permission is granted to copy, distribute and/or modify this document under
the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation.
LM-PROFILER.CONF(8)