Subj : Re: code profilers? To : comp.programming.threads From : Randy Date : Mon Aug 29 2005 07:19 am Jacek Popławski wrote: > Hello. > I am trying to profile multithreaded application (it works currently in Linux, > Windows and QNX). > > First I tried gprof, but output was wrong (0.00 everywhere, after few minutes > of code execution). I read (in Usenet archive) that there is some workaround > for gprof to work with multithreaded apps but I can't find any more information > about it. Can you point me to one? > > I tried qprof (http://www.hpl.hp.com/research/linux/qprof/), but I think it > works not like gprof, with default granularity output is very short, with small > granularity I get much more information but I am still not sure is it really > what I want. I failed giving qprof libunwind support, but I am working on it. > > Then I tried cprof (http://cprof.sourceforge.net/), it requires recompiling > (like gprof), I am still trying to understand output :) > > Is there anything else I should try? Portland Group's C/C++ compiler has a high-res profiler (PGPROF) that reports source-line level profile info. It's much more comprehensive than gprof, but the added profiling overhead makes the timing data less accurate. It profiles threads in Linux, so it should profile threads in Windows. You can download the entire compiler suite and evaluate it for 30 days. It's available for Windows. http://www.pgroup.com/products/workindex.htm For most precision with least overhead, look into using a hardware performance counter like PAPI. It provides very precise execution time info, but doesn't tie its numbers to each originating line of source code, and may not report info on individual threads. Additional tools are needed to report the counts for each source line of code, like HPCToolkit (Unfortunately, HPCToolkit does not work in Windows, even though PAPI does.) PAPI: http://icl.cs.utk.edu/papi/ HPCToolkit: http://hipersoft.cs.rice.edu/hpctoolkit/ Another hardware counter alternative is Intel's VTune, which *does* work in Windows. But IMHO, it's way too complex to be generally useful. However, for Windows it may be the only game in town. I'm pretty sure that like Portland Group's tools, you can download the Intel compilers and VTune for a free evaluation period. http://www.intel.com/cd/software/products/asmo-na/eng/vtune/index.htm FYI, NCSA's Vprof tool may also be useful, but I don't know it it works in Windows. I kinda doubt it. http://www.ncsa.uiuc.edu/UserInfo/Resources/Software/Tools/VProf/ Randy -- Randy Crawford http://www.ruf.rice.edu/~rand rand AT rice DOT edu .