title: CPU Cycle count based profiling in C/C++ Linux x86_64
body: <p>I am using the following code to profile my operations to optimize on cpu cycles taken in my functions.</p>
  
  <pre><code>static __inline__ unsigned long GetCC(void)
  {
    unsigned a, d; 
    asm volatile("rdtsc" : "=a" (a), "=d" (d)); 
    return ((unsigned long)a) | (((unsigned long)d) &lt;&lt; 32); 
  }
  </code></pre>
  
  <p>I don't think it is the best since even two consecutive calls gives me a difference of "33".
  Any suggestions ?</p>