Use Mongo finalize to compute avg and duration

This reduces the amount of things we do in Python and prepare for future
usage of more aggregation. It also returns real duration; API is then free
to override this with whatever it wants (and it does so).

Change-Id: I9850a4ab146612fbf85587f5553881a22acac67b
Signed-off-by: Julien Danjou <julien@danjou.info>
Merge "Use Mongo finalize to compute avg and duration"