Jwang add resource measurements

1. Move the resource usage tracking for a particular query into the `Query` object instead of in the `Server`. It makes much more sense there -- for example, if you do this then you won't have to expunge the data from multiple places when the query finishes. This will also let you immediately get the resource usage data for a particular query id directly.

2. You are welcome to add the subquery id in the API if you want. That doesn't resolve 1.