'Regularly save memory statistics.'

def at_repeat(self):

    pid = os.getpid()
    rmem = (float(os.popen(('ps    -p    %d    -o    %s    |    tail    -1' % (pid, 'rss'))).read()) / 1000.0)
    vmem = (float(os.popen(('ps    -p    %d    -o    %s    |    tail    -1' % (pid, 'vsz'))).read()) / 1000.0)
    (total_num, cachedict) = _idmapper.cache_size()
    t0 = ((time.time() - self.db.starttime) / 60.0)
    with open(LOGFILE, 'a') as f:
        f.write(('%s,    %s,    %s,    %s\n' % (t0, rmem, vmem, int(total_num))))
