Subject: RE: [hackers-il] timming cpu time in windows

From: Omer Musaev <[email-masked]>
Date: Sun, 15 Dec 2002 17:06:44 +0200

for a start, try gettimeofday

' -----Original Message-----
' From: Tzahi Fadida [mailto:[email-masked]]
' Sent: Saturday, December 14, 2002 8:58 PM
' To: [email-masked]
' Subject: [hackers-il] timming cpu time in windows
' 
' 
' hi all,
' I have a problem with a win32 consol programm in visual c++ i 
' am writing(in windows
' 2000). i am implementing the A* search algorithm and i need 
' to determine how much
' time it ran. the problem is when i use
' clock_t clock() from the time.h standard library, i get an 
' approximate time, which in
' the simple problems i give it, returns a zero time passed.
' my question is, where can i find a time function with greater 
' accuracy. so it will
' not return a zero, and at least retun some number. also, it 
' would be better if its
' not platform specific, or at least for a pentium and win2000.
' 10x.

Nadav would sue me for answering trivial technical questions, but...

You want to sample time before, sample time after and compare? 
Then all you want is time() equivalent, but with higher precision.

For Windows use QueryPerformanceCounter (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcekernl/ht
m/cerefQueryPerformanceCounter.asp )
and QueryPerformanceFrequency (
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcekernl/ht
m/cerefQueryPerformanceFrequency.asp )

For Unix (in case you'd like to port) use gettimeofday (
http://docs.sun.com/db/doc/802-5747-03/6i9g1bi49?a=view )

' * - * - *
' Tzahi Fadida
' [email-masked]
' Technion Email: [email-masked]
' My Cool Site: HTTP://WWW.My2Nis.Com

---

From: "Arik Baratz" <[email-masked]>
Date: Sun, 15 Dec 2002 18:31:57 +0200

If you send me the source files I can run TrueTime(tm) by Numega(tm) on them. This will go down to the microsecond level, and you'll know for sure where your bottlenecks are.

I require a VC6 project that compiles out-of-the box.

-- Arik

> -----Original Message-----
> From: Tzahi Fadida [mailto:[email-masked]]
> Sent: Sunday, December 15, 2002 5:36 PM
> To: [email-masked]
> Subject: RE: [hackers-il] timming cpu time in windows
> 
> 
> to answer myself, since it take 24hrs for an email to get to 
> the list members for
> some reason.
> I found micorosfts Hi-Res timers and used the timeGettime 
> function together with the
> devcaps on
> a 1ms resolution interval.
> the library is the multimedia timer library winmm.lib and the 
> header file mmsystem.h
> check out msdn for the rest.
> 
> still, the realy simple cases of my A star and Iterative 
> Deepening A star algoritms
> returns zero run-time
> because they are in micro- area.
> I didn't find a better Resolution timers, so i'll guess i'll 
> have to make do.
> 
> * - * - *
> Tzahi Fadida
> [email-masked]
> Technion Email: [email-masked]
> My Cool Site: HTTP://WWW.My2Nis.Com
> * - * - * - * - * - * - * - * - * - *
> 
> WARNING TO SPAMMERS:  see at 
> http://members.lycos.co.uk/my2nis/spamwarning.html
> 
> > -----Original Message-----
> > From: Tzahi Fadida [mailto:[email-masked]]
> > Sent: Saturday, December 14, 2002 8:58 PM
> > To: [email-masked]
> > Subject: [hackers-il] timming cpu time in windows
> >
> >
> > hi all,
> > I have a problem with a win32 consol programm in visual c++ 
> i am writing(in windows
> > 2000). i am implementing the A* search algorithm and i need 
> to determine how much
> > time it ran. the problem is when i use
> > clock_t clock() from the time.h standard library, i get an 
> approximate
> > time, which in
> > the simple problems i give it, returns a zero time passed
> > my question is, where can i find a time function with 
> greater accuracy. so it will
> > not return a zero, and at least retun some number. also, it 
> would be better if its
> > not platform specific, or at least for a pentium and win2000
> > 10x
> >
> > * - * - *
> > Tzahi Fadida
> > [email-masked]
> > Technion Email: [email-masked]
> > My Cool Site: HTTP://WWW.My2Nis.Com
> > * - * - * - * - * - * - * - * - * - *
> > WARNING TO SPAMMERS: see at 
http://members.lycos.co.uk/my2nis/spamwarning.html
>
>
>
>
> To unsubscribe from this group, send an email to:
> [email-masked]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>

To unsubscribe from this group, send an email to:
[email-masked]

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

---

From: "Arik Baratz" <[email-masked]>
Date: Mon, 16 Dec 2002 19:00:32 +0200

Take a look at LONGLONG. it is typedef-ed to __int64, which is Microsoft's 64 bit integer.

You don't have to have a 64 bit machine to use this 64 bit type. Have no fear. Use the QueryPerformanceCounter - it works in code I am currently editing.

-- Arik.

> Sent: Sunday, December 15, 2002 10:12 PM
> yes, queryperformancecounter did the trick. i tried it 
> before, but i thought at first
> it required special
> hardware to work. there is only one problem i am not sure 
> about. it uses
> large_interger which
> is a 64 bit in the quadpart.
> what lowgrade platforms can do 64bit? aside from my pentium III
> pentium2? pentium?
> 
> 
> * - * - *
> Tzahi Fadida
> > From: Arik Baratz [mailto:[email-masked]]
> > Sent: Sunday, December 15, 2002 4:51 PM
> > GetSystemTime -
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/sysinfo/ba
> > se/getsystemtime.asp - gets you millisecond resolution
> >
> > If you need a better resolution, go to
> > 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/sysinfo/ba
> se/high_resolution_timer.asp which has a 20 microsecond 
> resolution or so
> >
> > -- Arik
> >
> > > I have a problem with a win32 consol programm in visual c++ i
> > > am writing(in windows
> > > approximate time, which in
> > > my question is, where can i find a time function with greater
> > > accuracy. so it will
> > > ------------------------ Yahoo! Groups Sponsor
> > > ---------------------~-->
> > > Get 128 Bit SSL Encryption!
> > > http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/saFolB/TM
> > > --------------------------------------------------------------
> > > -------~->
> > >