takeProfile static method

Map<String, (double, int)> takeProfile()

GPU milliseconds and dispatch counts per kernel kind since the last call; empty if nothing was dispatched while profiling.

Implementation

static Map<String, (double, int)> takeProfile() {
  final n = kernelKinds.length;
  final ms = NativeKernels.allocate<Double>(n * 8);
  final counts = NativeKernels.allocate<Int64>(n * 8);
  final kinds = _profile(ms, counts, n);
  return {
    for (var k = 0; k < kinds && k < n; k++)
      if (counts[k] > 0) kernelKinds[k]: (ms[k], counts[k]),
  };
}