delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/25/14:53:50

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <4862947F.A2FC913B@dessent.net>
Date: Wed, 25 Jun 2008 11:54:55 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: Raja Saleru <raja DOT saleru AT iap-online DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: Does profiler works in cygwin ?
References: <DIEOIJJBNGICGPOHAEGCOEKFCBAA DOT raja DOT saleru AT iap-online DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Raja Saleru wrote:

> I would like to know whether we can compile the application in cygwin
> using -pg and then get the output using gprof.

gprof works, but I think your understanding of how it works is flawed.

> I am wonder why the time is zero in the below output result?

Probably because the entire runtime was less than the sampling period of
10ms.  In order to get any meaningful results from gprof you need a much
longer running program, because it works by periodic statistical
sampling.  See section 6 of the manual for more information:
<http://sourceware.org/binutils/docs-2.18/gprof/index.html>.

However, you need to also realize that even if this sample program was
longer running gprof only works at the function level.  In your program
essentially all of the work occurs in q_sort(), so gprof will never be
able to tell you much more than that.  It won't be able to tell you
which lines of q_sort() take the most time, only that X percent of time
was spent in q_sort() compared to Y percent of time in main() and
quicksort(), which is not very useful information.  You need to use a
different type of tool (such as gcov) if you want to know per-line
information.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019