Thread: [Dev-C++] Timing My Application
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Felipe L. <li...@cp...> - 2003-06-30 17:21:32
|
Is there any function or command or program that, under windows, returns = me how much time of CPU processing it spent? Must be someting in order = or ms(milisseconds) or less.=20 Thankx. -=3D-=3D-=3D-=3D-=3D-=3D- Felipe Lima - Software Tester/ Developer CPTS - Software Test Research Center HP Brazil - PUCRS |
From: David M. <ci...@ya...> - 2003-06-30 17:48:59
|
Maybe I can do a little better. clock in time.h returns the number of CPU clock 'ticks' since the process started. Combine that with the macro CLK_TCK which gives you the number of ticks per second you can get the most accurate timer that your processor can handle. And best of all it is ANSI compliant. --- Felipe Lima <li...@cp...> wrote: > Is there any function or command or program that, under > windows, returns me how much time of CPU processing it > spent? Must be someting in order or ms(milisseconds) or > less. > > > Thankx. > > -=-=-=-=-=-=- > Felipe Lima - Software Tester/ Developer > CPTS - Software Test Research Center > HP Brazil - PUCRS ===== Signed David Mcken Life Sucks Live with it __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |
From: Ioannis V. <iv...@em...> - 2003-06-30 19:27:43
|
There is not any CLK_TCK as part of any C or C++ standard. You are probably refering to CLOCKS_PER_SEC. After a search on the web I came up to this: http://www.lysator.liu.se/c/c-errata.html Check your macro name there. My Greek K&R 2 has it correctly. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net > -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of David McKen > Sent: Monday, June 30, 2003 8:49 PM > To: Dev-C Mailing List > Subject: Re: [Dev-C++] Timing My Application > > > Maybe I can do a little better. > > clock in time.h returns the number of CPU clock 'ticks' > since the process started. Combine that with the macro > CLK_TCK which gives you the number of ticks per second you > can get the most accurate timer that your processor can > handle. And best of all it is ANSI compliant. > > --- Felipe Lima <li...@cp...> wrote: > > Is there any function or command or program that, under > > windows, returns me how much time of CPU processing it > > spent? Must be someting in order or ms(milisseconds) or > > less. > > > > > > Thankx. > > > > -=-=-=-=-=-=- > > Felipe Lima - Software Tester/ Developer > > CPTS - Software Test Research Center > > HP Brazil - PUCRS > > > ===== > Signed > David Mcken > > Life Sucks > Live with it > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_06 1203_01/01 _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Per W. <pw...@ia...> - 2003-06-30 22:03:17
|
Too fast answer :-) What I meant to say is that clock() requires the application to get the start value, so it can't retrieve all used time for a process. Also, depending on implementation you really have to take care of overflow. A third thing. It can't handle children. For that you need to call the times() function. The correct frequency of clock() is CLOCKS_PER_SEC. /Per W On Mon, 30 Jun 2003, David McKen wrote: > Maybe I can do a little better. > > clock in time.h returns the number of CPU clock 'ticks' > since the process started. Combine that with the macro > CLK_TCK which gives you the number of ticks per second you > can get the most accurate timer that your processor can > handle. And best of all it is ANSI compliant. > > --- Felipe Lima <li...@cp...> wrote: > > Is there any function or command or program that, under > > windows, returns me how much time of CPU processing it > > spent? Must be someting in order or ms(milisseconds) or > > less. > > > > > > Thankx. > > > > -=-=-=-=-=-=- > > Felipe Lima - Software Tester/ Developer > > CPTS - Software Test Research Center > > HP Brazil - PUCRS > > > ===== > Signed > David Mcken > > Life Sucks > Live with it > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2003-06-30 22:14:42
|
Note that this is just wall time, and doesn't have anything with CPU time to do. /Per W On Mon, 30 Jun 2003, David McKen wrote: > Maybe I can do a little better. > > clock in time.h returns the number of CPU clock 'ticks' > since the process started. Combine that with the macro > CLK_TCK which gives you the number of ticks per second you > can get the most accurate timer that your processor can > handle. And best of all it is ANSI compliant. > > --- Felipe Lima <li...@cp...> wrote: > > Is there any function or command or program that, under > > windows, returns me how much time of CPU processing it > > spent? Must be someting in order or ms(milisseconds) or > > less. > > > > > > Thankx. > > > > -=-=-=-=-=-=- > > Felipe Lima - Software Tester/ Developer > > CPTS - Software Test Research Center > > HP Brazil - PUCRS > > > ===== > Signed > David Mcken > > Life Sucks > Live with it > > __________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo. > http://search.yahoo.com > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Per W. <pw...@ia...> - 2003-06-30 21:57:27
|
No clock functions might be used, since they return wall time, and doesn't take into account how much CPU the actual program got. Under windows, you should use GetThreadTimes(), which will report amount of time spent in user and kernel for a single thread, or GetProcessTimes() that reports used time for a process. Under unix, the corresponding call is getrusage(). /Per W No clock functions might be used, since On Mon, 30 Jun 2003, Felipe Lima wrote: > Is there any function or command or program that, under windows, returns me how much time of CPU processing it spent? Must be someting in order or ms(milisseconds) or less. > > > Thankx. > > -=-=-=-=-=-=- > Felipe Lima - Software Tester/ Developer > CPTS - Software Test Research Center > HP Brazil - PUCRS |