How can i measure runtime??

  • Follow


Hi all,
Is it possible to measure the execution time and complexity of my
program in bloodshed developer c++ ?If so, please tell me how.


      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Reply vidit.iitr (2) 8/1/2006 12:41:30 PM

vidit wrote:
> Hi all,
> Is it possible to measure the execution time and complexity of my
> program in bloodshed developer c++ ?If so, please tell me how.

  Well, it's not exactly a question about C++ language, but as far as I
understand, Bloodshed environment used gcc as their C/C++ compiler. gcc
allows you to use profiling. For more information google 'gprof' which
is a profiler that gcc uses.


      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Reply Michael 8/1/2006 7:59:54 PM


vidit wrote:
> Is it possible to measure the execution time and complexity of my
> program in bloodshed developer c++ ?If so, please tell me how.

I don't know about 'bloodshed developer c++' but you're most likely
looking for what is called "a profiler".  Google for it or ask in the
newsgroup dedicated to your OS -- they are platform-specific.

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask



      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Reply Victor 8/2/2006 1:26:44 AM

Hi,

> Is it possible to measure the execution time and complexity of my
> program in bloodshed developer c++ ?If so, please tell me how.

Runtime: Yes. That's the clock() function declared in <ctime>
that would come helpful. It might not be very precise, or precise enough
for your purpose. Other bets are(less standardized) gettimeofday() 
(POSIX, not ANSI-C) or the command line program "time" (likely also 
POSIX, clearly not ANSI-C), or the high-precision timers of windows 
(only Win32, not POSIX, not ANSI), or the profiler of your choice 
(entirely compiler dependent), e.g. gprof of the GNU toolchain.

Complexity: I'm not aware how I should be able to measure this. 
Complexity gives asymptotic behaivour of algorithms for the data set
size growing to infinity, thus this is something that must be proven
and cannot really be measured on a finite machine.

So long,
	Thomas

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]

0
Reply Thomas 8/2/2006 12:22:43 PM

3 Replies
350 Views

(page loaded in 1.828 seconds)

Similiar Articles:













7/24/2012 1:29:29 AM


Reply: