Add server and result level stats storage

The server stats are automatically stored using the before and after hooks. We
store the uuid and the start time in the request in the before hook, and
compute the duration and store the entry in the after hook.

For the result stats, I just inserted entries at various parts of the code. The
entries are inserted using constants defined in the stats file, so that we know
what all of them are.

I added a new unit test case for the calculation of the sum, and tested that
the stats are inserted correctly manually due to lack of time. A unit test is
pending and will be checked in soon.

All this code is exercised using existing unit tests, all of which pass. The
storage code is copied from the client stats code, which is known to work. For
completeness, we just need to add a new unit test testing that the generated
stats are indeed stored correctly in the database.

I have filed an issue to track this.