[computer-go] Precise clock cycles measurements

Łukasz Lew lukasz.lew at gmail.com
Thu Aug 31 06:05:42 PDT 2006


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


More information about the computer-go mailing list