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 X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: Raja Saleru CC: cygwin AT cygwin DOT com Subject: Re: Does profiler works in cygwin ? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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: . 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/