stats: const/indent cleanup
stats: put command stat generation into own command_stats class
core: moved common DIFF() macros into core header, it was previously defined 3 times in the code
stats: added per-backend commands statistics