# Calculating Floating point Operations Per Second(FLOPS) and Integer Operations Per Second(IOPS)

I am trying to learn some basic benchmarking. I have a loop in my Java program like,

float a=6.5f;
int b=3;
for(long j=0; j<999999999; j++){
var = a*b+(a/b);
}//end of for


My processor takes around 0.431635 second to process this. How would I calculate processor speed in terms of Flops(Floating point Operations Per Second) and Iops(Integer Operations Per Second)? Can you provide explanations with some steps?

-
Each loop is 3 FO, you know how many loops where done and the time. Do the math. Or check out the benchmarks at cs.bell-labs.com/cm/cs/pearls/appmodels.html (in C, but should give you an idea how to do it in Java). –  vonbrand Jan 25 at 7:22

It really depends on the optimizer. If you compile it with optimization, it might get rid of the loop, and then it will take rather less than 0.431635 seconds. Otherwise, it seems like you have four to five floating point instructions per iteration (including int to float conversion, once or twice, depending on the optimizer), so $4\cdot10^9$ or $5\cdot10^9$ in total. Divide this by 0.431635 to get your FLOPS, which will be around $10^{10}$, or 10 GFLOPS.

-