Create stats abstraction

Reviewer: @harshsin

The main goal is to assign integer IDs to stats and eventually store them in a
shared memory segment. The side benefit is that this interface will allow us to
use a separate stats array per thread. Neither of these features is actually
implemented in this pull request, just the interface.