added build time option --enable/disable-stats to enable/disable stats collection.