Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!genrad!decvax!tektronix!uw-beaver!cornell!batcomputer!cohler From: cohler@batcomputer.UUCP Newsgroups: comp.lang.c++ Subject: Re: Profiling C++ Message-ID: <201@batcomputer.tn.cornell.edu> Date: Wed, 18-Feb-87 00:41:30 EST Article-I.D.: batcompu.201 Posted: Wed Feb 18 00:41:30 1987 Date-Received: Fri, 20-Feb-87 04:04:41 EST Reply-To: cohler@batcomputer.UUCP (Gene Cohler) Distribution: comp Organization: Theory Center, Cornell University, Ithaca NY Lines: 22 Keywords: gprof, profiling This may be of general interest so I am replying to the group. We use profiling with C++ and found we had to use a small kludge to get things to go through. As I understand it, the profiler uses its own version of the standard c library, in particular the usual exit code is replaced to by an exit that creates the gmon.out file. C++ merrily takes over exit thus preventing this file from being written. One simple way out is to use ar to suck out exit.o from the C++ libC.a file and then link to that instead. This means that global destructors will not be called - that has not been a problem for us. Presumably, what is required to do it properly would be to adjust the C++ exit code to do the right thing (A profiled libCp.a ?). Gene Cohler (cohler@tcgould.tn.cornell.edu) -- Gene Cohler ARPA: cohler@tcgould.tn.cornell.edu Newman Lab/Cornell Univ Usenet: cornell!batcomputer!cohler Ithaca NY 14853 Bitnet: jbvy@cornella.bitnet