benchmark tool?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > benchmark tool?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    benchmark tool?  
pembed2003


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

Hi all,
I have written a few programs in C/C++ but some of them are slow and I
need to find out where most of the execution time is spend. Do you
know of any tool that reports that? Like it will tell me that my
function foo is taking up 90% of the time or this loop is only using
1% of the time, etc. Thanks!





[ Post a follow-up to this message ]



    Re: benchmark tool?  
sean larsson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

On 22 Jun 2004 17:56:11 -0700
pembed2003@yahoo.com (pembed2003) wrote:

> Hi all,
> I have written a few programs in C/C++ but some of them are slow and I
> need to find out where most of the execution time is spend. Do you
> know of any tool that reports that? Like it will tell me that my
> function foo is taking up 90% of the time or this loop is only using
> 1% of the time, etc. Thanks!

man gprof.  and if u google for profilers you'll find other stuff. those too
ls will tell you what functions are taking up time, but if you want to get s
pecific as to what loops are doing what, u need something else.  there is a 
tool that intel provides fo
r intels only obviously. it is pretty in depth, but not free.  i wrote a tool for doing
 this, it works on pentiums and uses the rdtsc instruction.  see here: http://foru
ms.devshed.com/t108319/s.html

--
-sean





[ Post a follow-up to this message ]



    Re: benchmark tool?  
Nick Landsberg


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

sean larsson wrote:
> On 22 Jun 2004 17:56:11 -0700
> pembed2003@yahoo.com (pembed2003) wrote:
>
> 
>
>
> man gprof.  and if u google for profilers you'll find other stuff. those tools wil
l tell you what functions are taking up time, but if you want to get specific as to 
what loops are doing what, u need something else.  there is a tool that intel provid
es
for intels only obviously. it is pretty in depth, but not free.  i wrote a tool for doing this, it work
s on pentiums and uses the rdtsc instruction.  see here: [url]http://forums.devshed.com/t108319/s.html[
/url]
>

As a first step "gprof" is pretty good in that it tell you what
routines are being called most often and take up the most
time.  At least you can narrow it down that way.

Example: 98% of the time is being spent in routine foobar().

Choices:
1. Call foobar() less often
2. Find a replacement for foobar()
3. Optimize foobar()

Choice 1 is almost always better than choice 2, in my
experience, but it's harder to do, so most folks
start right on choice 3.  In a previous thread, one
poster, whose name I forgot, mentioned that he saw
someone once try to optimize the assembler for
a bubble-sort routine.

Look at both the frequency with which a routine is
called *and* the percent of total time that
the routine takes up.  If all you have is one
big routine, maybe you should re-evaluate your
design decisions.

Past that, it's up to you to know how to do things
as move invariants out of loop constructs and such.

If "gprof" shows that the usage is evenly spread out
between 20 or so routines/functions/methods, you are
usually SOL.

NPL

--
"It is impossible to make anything foolproof
because fools are so ingenious"
- A. Bloch





[ Post a follow-up to this message ]



    Re: benchmark tool?  
Alex Vinokur


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM


"pembed2003" <pembed2003@yahoo.com> wrote in message news:db593abd.0406221656.34036660@posti
ng.google.com...
> Hi all,
> I have written a few programs in C/C++ but some of them are slow and I
> need to find out where most of the execution time is spend. Do you
> know of any tool that reports that? Like it will tell me that my
> function foo is taking up 90% of the time or this loop is only using
> 1% of the time, etc. Thanks!

Tool for measuring comparative performance of the C/C++ code (C/C++ Program 
Perfometer):

http://groups.google.com/groups?sel...rlin
.de (Brief Description)
http://article.gmane.org/gmane.comp...B.perfometer/39 (Latest : Rel
ease 2.8.0-1.18)
http://alexvn.freeservers.com/s1/pe...sts/pftests.htm (C/C++ Performance 
Tests)
http://news.gmane.org/group/gmane.c...view/10978.html
http://sourceforge.net/users/alexvn








[ Post a follow-up to this message ]



    Re: benchmark tool?  
pembed2003


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

sean larsson <infamous42md@ERASEMEhotpop.com> wrote in message news:<20040622211706.040de53a
.infamous42md@ERASEMEhotpop.com>...
> On 22 Jun 2004 17:56:11 -0700
> pembed2003@yahoo.com (pembed2003) wrote:
> 
>
> man gprof.
>

Hi Sean,
Thanks for pointing me to gprof. I man gprof but still can't figure
out how to use it! The executable I am trying to gprof is call 'test'
and I have tried:

$ gprof
gprof: fopen: a.out: No such file or directory

$ gprof -o test
gprof: fopen: gmon.out: No such file or directory

$ mv test a.out
$ gprof
gprof: fopen: gmon.out: No such file or directory

$ gprof -s
gprof: fopen: gmon.out: No such file or directory

$ gprof -D
gprof: fopen: gmon.out: No such file or directory

I wish the man page includes a few example of how to use the tool but
there is none. Can you give me a few pointers / examples of how to use
it?

Thanks!





[ Post a follow-up to this message ]



    Re: benchmark tool?  
sean larsson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

On 23 Jun 2004 10:46:15 -0700
pembed2003@yahoo.com (pembed2003) wrote:

> sean larsson <infamous42md@ERASEMEhotpop.com> wrote in message news:<20040
622211706.040de53a.infamous42md@ERASEMEhotpop.com>... 
>
> Hi Sean,
> Thanks for pointing me to gprof. I man gprof but still can't figure
> out how to use it! The executable I am trying to gprof is call 'test'
> and I have tried:
>
> $ gprof
> gprof: fopen: a.out: No such file or directory
>
> $ gprof -o test
> gprof: fopen: gmon.out: No such file or directory
>
> $ mv test a.out
> $ gprof
> gprof: fopen: gmon.out: No such file or directory
>
> $ gprof -s
> gprof: fopen: gmon.out: No such file or directory
>
> $ gprof -D
> gprof: fopen: gmon.out: No such file or directory
>
> I wish the man page includes a few example of how to use the tool but
> there is none. Can you give me a few pointers / examples of how to use
> it?
>
> Thanks!

'info gprof' will give u the goods. i should have said that b4, my bad.

--
-sean





[ Post a follow-up to this message ]



    Re: benchmark tool?  
Brian Raiter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

> Thanks for pointing me to gprof. I man gprof but still can't figure
> out how to use it! The executable I am trying to gprof is call 'test'
> and I have tried:

Assuming that you compiled test with profiling data, it looks like you
just forgot to run your program before calling gprof. (Either that, or
you ran gprof from a directory other than where your binary lives.)

b





[ Post a follow-up to this message ]



    Re: benchmark tool?  
pembed2003


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-26-04 03:11 PM

blr@drizzle.com (Brian Raiter) wrote in message news:<cbd6re$e88$1@drizzle.com>... 
>
> Assuming that you compiled test with profiling data, it looks like you
> just forgot to run your program before calling gprof. (Either that, or
> you ran gprof from a directory other than where your binary lives.)
>
> b

Hi Brian / Sean,
I 'info gprof' and ran my 'test' executable and now I can see what
function takes the longest time in my program. I have an additional
question:

I compiled my program with -pg so some symbles are inserted into my
program for prof, how can I strip out those symbles later on? Do I
always have to recompile without '-pg' or is there a way to strip out
the symbles?

Thanks!





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:54 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register