[computer-go] Precise clock cycles measurements

Corey Harris charris at mailshack.com
Sun Sep 3 04:03:59 PDT 2006


For VC++ users, you can use this code from www.codeguru.com

http://www.codeguru.com/cpp/misc/misc/timers/article.php/c3895/

It still works on MSVC 2005.

Corey Harris


----- Original Message ----- 
From: "Łukasz Lew" <lukasz.lew at gmail.com>
To: "computer-go" <computer-go at computer-go.org>
Sent: Thursday, August 31, 2006 8:05 AM
Subject: [computer-go] Precise clock cycles measurements


> IMHO this is a way better than profiler.
> To measure clock cycles accurately of function call
>
> play(color, move)
>
> you may use
>
> unsigned long cc_time;
> cc_time_of(cc_time, play(color, move));
>
> Use this macro, (works for g++):
> [ Can someone port it to other compilers? ]
> ---
>
> #define get_cc_cnt(tsc)  __asm__ __volatile__("rdtsc" : "=A" (tsc) : : 
> "edx")
>
> #define cc_time_of(t ,instr) \
>  do {\
>    unsigned int cc_start, cc_stop;\
>    get_cc_cnt(cc_start);\
>    instr;\
>    get_cc_cnt(cc_stop);\
>    t = cc_stop - cc_start - 43;\
>  } while (0)
>
> ---
>
> So what are Your average cc times of playing:
> one move?
> playout?
>
> Best regards,
> Łukasz
>


--------------------------------------------------------------------------------


> _______________________________________________
> computer-go mailing list
> computer-go at computer-go.org
> http://www.computer-go.org/mailman/listinfo/computer-go/ 




More information about the computer-go mailing list