     cpus: cpus
     vifs: vifs
     xvds: xvds
+    timestamp: Date.now()
   }
+
+  # the final object
+  return points[vm.id]
 
 stats.params = {
   id: { type: 'string' }

exports.detachPci = detachPci
#---------------------------------------------------------------------


stats = $coroutine ({vm, granularity}) ->
  granularity = if granularity then granularity else 0
  # granularity: 0: every 5 sec along last 10 minutes, 1: every minute along last 2 hours, 2: every hour along past week, 3: everyday along past year
  # see http://xenserver.org/partners/developing-products-for-xenserver/18-sdk-development/96-xs-dev-rrds.html
  xapi = @getXAPI vm

  host = @getObject vm.$container

      return
    return

  points[vm.id] = {
    memoryFree: memoryFree
    memoryUsed: memoryUsed
    memory: memory
