record static method

void record(
  1. String name,
  2. int micros
)

Records an elapsed micros span under name.

Only call from inside an if (D4rtProfiler.enabled) guard so it is dead-code-eliminated when the profiler is off.

Implementation

static void record(String name, int micros) {
  var entry = _entries[name];
  if (entry == null) {
    entry = _ProfileEntry(name);
    _entries[name] = entry;
    _order.add(name);
  }
  entry.totalMicros += micros;
  entry.count++;
}