Fixed a couple of complier warnings, and added a new PerfStat class for monitoring runtime performance