Archived

This topic is now archived and is closed to further replies.

Iron Eye

Working clock cycle counting code for MinGW (gcc)

Recommended Posts

I''m developing in Dev-cpp and want to start expiermenting with optimizations, I did a quick google for some code that counts the clock cycles required to do a given block of code, and none compiled, I think it may have to do with function inlining. For instance:
  
__forceinline void CountCycles() 
{ 
   __asm { 
      RDTSC 
      mov DWORD PTR[clockCycles+4],edx 
      mov DWORD PTR[clockCycles],eax 
   } 
} 

Spits an error

So I changed it to:

inline void CountCycles() 
{ 
   __asm { 
      RDTSC 
      mov DWORD PTR[clockCycles+4],edx 
      mov DWORD PTR[clockCycles],eax 
   } 
} 

And it then comlained about "__asm".
  
I''m still quite the newbie, but still intrested in optimization none the less, couldn''t hurt to start developing good habbits early, eh? ---
-Iron Eye
Cyrus Eye design  _//_  My personal site  _//_  Google

"Games usually keep me from making my own..."

Share this post


Link to post
Share on other sites