     samples.append(time)
   }
 
+  resetMeasurements()
   test.setUpFunction?()
 
   // Determine number of iterations for testFn to run for desired time.
   func iterationsPerSampleTime() -> (numIters: Int, oneIter: Int) {
-    let oneIter = sampler.measure(test.name, fn: testFn, numIters: 1)
+    let oneIter = measure(test.name, fn: testFn, numIters: 1)
     if oneIter > 0 {
       let timePerSample = Int(c.sampleTime * 1_000_000.0) // microseconds (μs)
       return (max(timePerSample / oneIter, 1), oneIter)

  func measureMemoryUsage() -> Int {
    let current = SampleRunner.getResourceUtilization()
    let maxRSS = current.ru_maxrss - baseline.ru_maxrss

    if c.verbose {
      let pages = maxRSS / sysconf(_SC_PAGESIZE)
      func deltaEquation(_ stat: KeyPath<rusage, Int>) -> String {
        let b = baseline[keyPath: stat], c = current[keyPath: stat]
        return "\(c) - \(b) = \(c - b)"
      }
      print("""
                MAX_RSS \(deltaEquation(\rusage.ru_maxrss)) (\(pages) pages)
                ICS \(deltaEquation(\rusage.ru_nivcsw))
                VCS \(deltaEquation(\rusage.ru_nvcsw))
            """)
    }
    return maxRSS
  }


  }
  logVerbose("Running \(test.name) for \(c.numSamples) samples.")

  var samples: [Int] = []
  samples.reserveCapacity(c.numSamples)

