Collect statistics for commands