Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <003b01c1158f$f8281e90$9865fea9@timayum4srqln4> From: "Tim Prince" To: "Francois Colbert" , References: <000701c1158b$4ab07400$59cdfdcf AT lambda> Subject: Re: gprof prints incorrect results Date: Wed, 25 Jul 2001 22:01:01 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 ----- Original Message ----- From: "Francois Colbert" To: Sent: Wednesday, July 25, 2001 9:27 PM Subject: gprof prints incorrect results > Hi. > > I tried to use the gprof utility, but I was unable to get useful > results with the Cygwin version. > > I made a simple test program (see below: prof.cpp) and tried to > profile it on a Linux system (with pre-installed utilities) and on a > Windows system (with Cygwin utilities: gprof version 2.11.90, gcc > version 2.95.2-6.). On each platform, I compiled the program using > the command line > > gcc -pg prof.cpp -o prof.exe > > I executed prof.exe to generate a gmon.out file, and then I ran gprof > using the command line > > gprof --brief prof.exe gmon.out > prof-win32.txt > > under Windows, and > > gprof --brief prof.exe gmon.out > prof-linux.txt > > under Linux. > > > The two resulting text files, prof-win32.txt and prof-linux.txt, are > listed below. I didn't expect the timing data to be similar, because > they are the result of the execution of two different executables in > two different contexts. > > Nonetheless, I expected the statistics related to the call graph to be > exactly the same. They aren't. I identified the following anomalies > in the prof-win32.txt file: > > 1- In the flat profile section, number-of-calls stats are missing. > > 2- In the call graph section, the last column doesn't show any useful > data, since every function either is "spontaneous" or appears to be > called only by itself. > > 3- In the functions index at the end of the file, the DoSomething > function is missing. It wasn't missing for every execution of the > test program, though. I expect this would be improved if you built the entire run-time library with -pg. The cygwin setup doesn't provide for automatically linking a profiling version of the run-time. A possible work-around is to build a separate copy of the run-time libraries and link specifically against those libraries. Recursive calling will be "spontaneous" no matter what you do. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/