docs: def flush(self):
          """
          Save the measurements on the performance file (or on stdout)
          """
          if not self._flush:
              raise RuntimeError(
                  'Monitor(%r).flush() must not be called in a worker' %
                  self.operation)
          for child in self.children:
              child.hdf5 = self.hdf5
              child.flush()
          data = self.get_data()
          if len(data) == 0:  # no information
              return []
          elif self.hdf5:
              hdf5.extend(self.hdf5['performance_data'], data)
  
          # reset monitor
          self.duration = 0
          self.mem = 0
          self.counts = 0
          return data