From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,d6e8c5fd420eb2c9 X-Google-Attributes: gid1164f8,public X-Google-Thread: fee84,d6e8c5fd420eb2c9 X-Google-Attributes: gidfee84,public From: John P Williams Subject: Re: Profiler for OSF Date: 1998/04/24 Message-ID: <3540CF7A.CF981647@zk3.dec.com>#1/1 X-Deja-AN: 347381062 Content-Transfer-Encoding: 7bit References: <353C577F.4F65@sasib18.sasibrlw.bo.nettuno.it> To: Marco Alberoni Content-Type: text/plain; charset=us-ascii Organization: CTG Mime-Version: 1.0 Newsgroups: comp.sys.dec,comp.unix.osf.osf1 > I need to profile some processes which link shared libraries > at run time (procedures belonging to these libraries are loaded > using "dl_open" calls). > I work on a digital workstation. Tools on the machine like > prof or gprof don't permit to profile such kind of processes. > Which kind of tool (if existing) can I use? If your workstation is an Alpha running Digital UNIX V4.0 or later, and if you are actually calling the dlopen(3) runtime library routine, there are a few options you can use. I do not understand Dirk Grunwald's distinction between "shared libraries" and "modules". As far as I have been able to find out, dlopen(3) only loads shared libraries, and atom(1) is able to instrument shared libraries that are loaded with dlopen(3) - you just need to name the libraries in the atom command. However, I will be happy to be corrected. 1) Compiling the program with the -p flag (as I guess you did), you can: setenv PROFFLAGS -all setenv _RLD_LIST DEFAULT:lib1.so:lib2.so as described in the prof(1) and loader(5) man-pages. Setting PROFFLAGS to -all requests profiling of all shared libraries. Setting _RLD_LIST to DEFAULT plus a list of the application's libraries that are dynamically opened with dlopen(3) tells the loader to load the shared libraries as if they had been linked into the program with ld(1). So, if the application can tolerate this change in when the libraries are loaded, this should help. 2) A command like atom -tool hiprof -incobj lib1.so -incobj lib2.so app or atom -tool pixie -incobj lib1.so -incobj lib2.so app should let you use hiprof with gprof to print a call-graph profile or to use pixie with prof to print various instruction-count profiles. The -incobj flags tell atom(1) to instrument the specified shared libraries even if they are loaded with dlopen. If the program does not use threads, the hiprof profile can be enhanced with the atom -toolargs=-cputime option, which gives a non-sampled profile in terms of CPU cycles used, instead of instructions executed. The atom command and its hiprof and pixie tools (etc) are in the optional software development subsets in the Digital UNIX kit. If you would like to use the latest versions of these tools on Digital UNIX V4.0 or later, please send me email for information on our field-test quality Advance Developer's Kit. 3) The Digital Continuous Profiling Infrastructure (DCPI) is currently available as a free but licensed advance development distribution: http://www.research.digital.com/SRC/dcpi/ It uses the Alpha processor's hardware performance counters to profile a whole system at very low overhead and then analyze the results off-line. Its profiles use a higher sampling rate than does compiling with -p. It profiles all applications' uses of each shared library, so you may need to ensure that only your application is running while the profile is being collected. Please send me email if you would like more information. John P Williams, Digital UNIX Development Environment Group