PDA

View Full Version : How to benchmark?


Calmatory
05-05-2008, 12:56 PM
This might not be the best place for this thread, considering that this isn't programming forum or neitehr this is programming section, but w/e, hopefully there is some devs out there.

Basically what I want to know is HOW to bench in efficient way. Sure I can do while(1) { a = 1+1; } etc. but that is far from efficient. That doesn't load the CPU really, thanks to compiler optimizations, how operating system works and CPU architecture (and branch prediction, i think! ;)).

Recently I have been working on different kinds of approaches and techniques. Mainly trying to be as close to real life as possible by benching different aspects. Conditional jumps, integer&floating point divs/multiplies, trigonometric functions and squareroot, bitshifting, string manipulation, array manipulation etc.

What I have seen is that I can't load the CPU properly. PerfMonitor shows that there are still many idle cycles. No L1/L2/DRAM accessing(which is god for pure, raw power CPU bench though). This might be due to the fact that everything I wrote has been single-threaded. All of the stuff I have tested have been multithreaded and showed to be very efficient in terms of loading CPU/L1/L2/DRAM. OCCT, Orthos, S&M, CINEBENCH etc.

So basically I can load the CPU. I can make it to compute alot of stuff. But what I can't do is to load it in efficient way, so there won't be idle cycles, there will be L1/L2/DRAM access if needed etc.

Writing a simple benchmark is no problem, but making it efficient, and making it to utilize the full potential of the CPU is more tricky. So any help is more than welcome!

(as I said in the beginning, this might not be the best place really. The correct section seems to be SO inactive that I find this better suitable here, besides, there has been some devs around here talking about benchmarks programming-wise or from technical aspect, so I might have some luck!)