This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Does profiler works in cygwin ?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]