From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a0ff1df3c152ae8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-14 06:21:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3BF27DE6.C6620CE7@Raytheon.com> From: Mark Johnson X-Mailer: Mozilla 4.5 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNAT and profiling! References: <3BF22DF1.B59AC367@ida.his.se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 14 Nov 2001 08:21:27 -0600 NNTP-Posting-Host: 192.27.48.44 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1005747700 192.27.48.44 (Wed, 14 Nov 2001 08:21:40 CST) NNTP-Posting-Date: Wed, 14 Nov 2001 08:21:40 CST Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:16497 Date: 2001-11-14T08:21:27-06:00 List-Id: Michael Andersson wrote: > Hi! > I want to use gcov to profile my code. The problem is that I want to > compare one version of a program with a new version of the program to > see weather or not I gained some performace. But from what I can se gcov > counts how many times each line of code was executed. This would mean > that each version would have to be executed an equal amount of time. I > could use a counter for each function an print the contents of the > counter each frame and then compare it the output from the other version > of the program. This could become quite an effort since there are a lot > of functions to compare. > > Could I in some way use gcov to do this? I am not sure why you would want to do that. Can you describe what problem you are trying to solve? For example, if you want to reduce run time or CPU time for the "same" amount of work, why not measure that? You can give each version the same amount of work and check it externally. That would be the measure of improvement. Then you use gcov to figure out the hot spots in your code - fix them, and rerun the measurements. Another note on gcov and similar coverage tools - turn off code inlining until the very end of your analysis. We had an application that used a linear search through an unordered list to look up tokens. OK for small jobs - very inefficient on anything sizable. The original author had inlined the look up function, so there were hot spots all over the application. It wasn't until we got rid of that inlining to find our real problem - fix the algorithm, and then the application ran MUCH faster. --Mark