Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > benchmarking c programs

Reply
Thread Tools

benchmarking c programs

 
 
Ben
Guest
Posts: n/a
 
      06-11-2006
Hi,
I am wondering if there is an easy way to benchmark a c program as a way of measuring the efficiency of the program,
specifically the number of different instructions performed and total running time.
I have used other languages where the interpreter has a built-in flag to give you this information but not sure what the
equivalent is in c.
cheers,
Ben
 
Reply With Quote
 
 
 
 
russell kym horsell
Guest
Posts: n/a
 
      06-11-2006
Ben <> wrote:
> Hi,
> I am wondering if there is an easy way to benchmark a c program as a way of measuring the efficiency of the program,
> specifically the number of different instructions performed and total running time.
> I have used other languages where the interpreter has a built-in flag to give you this information but not sure what the
> equivalent is in c.
> cheers,
> Ben



Some compilers -- e.g. gcc -- have a "profiling" feature that allow you to
automatically count the number of times each line/statement is executed.
If you want to count "instructions" then some x86 processors (and others)
allow you to setup counters for certain "events" such as instruction fetches
or memory read/writes. But that is a function of the operating system.


If you want to measure program runtime and guestimate the number of instructions
executed (not forgetting with multiple pipeline machines these days, this is
not to squeezy anymore) then you're also outside the (strictly) C domain
and into operating system functionality & tools.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SimpliSoftware RW HD Tach v.3.0.1.0 Benchmarking Software @ ThinkComputers.org Silverstrand Front Page News 0 11-27-2005 04:36 PM
Benchmarking whole programs gabriele renzi Ruby 0 04-05-2005 04:29 PM
Benchmarking embedded Java Martin Schoeberl Java 1 09-25-2004 10:48 AM
Benchmarking Jerry Coffin C++ 0 06-20-2004 08:14 PM
XSLT benchmarking and performance advice ? Andy Dingley XML 3 02-11-2004 01:06 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57