Pink Iguana

Home » Uncategorized » rdtsc in the Age of Sandybridge

rdtsc in the Age of Sandybridge

Random ASCII - tech blog of Bruce Dawson

Years ago I wrote a program that would dynamically measure the speed of my CPU. It would record the current number of CPU clock ticks with __rdtsc() (the C/C++ intrinsic for the rdtsc instruction), then wait some period of time (measured with QueryPerformanceCounter()), and then see how many CPU ticks had elapsed during that period. It was fascinating, in a pointless and geeky way, to see how the CPU clock speed changed as the load changed.

rdtsc has changed a lot since then. My Sandybridge CPU is rated at 2.20 GHz and the rdtsc instruction on it returns a rock-solid 2.195 GHz at all times. I could feel ripped off that my 2.20 GHz CPU runs 1.1% slow, but it turns out that isn’t the full story.

View original post 724 more words

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: