Fix the inaccurate ops/sec

This patch actually does two things

* fix the bug of inaccurate ops/sec
* Make some handy changes on the code style