Jump to content
  • Advertisement

Archived

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

Iron Eye

Working clock cycle counting code for MinGW (gcc)

This topic is 5808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!