public IDisposable Subject(string category, string subject, Dictionary <string, object> metadata = null) { var record = new PerfRecord(category, subject, _stopwatch.ElapsedMilliseconds, metadata); _records.Add(record); return(new Marker(record, _stopwatch)); }
public void Start(string operationName) { _main = new PerfRecord("operation", operationName, 0); lock (_lock) { _records.Add(_main); } _stopwatch.Start(); }
public void Start(string operationName) { if (!_enabled) { return; } _main = new PerfRecord("operation", operationName, 0); _records.Add(_main); _stopwatch.Start(); }
public Metrics Start(string operationName) { if (_enabled) { _main = new PerfRecord("operation", operationName, 0); _records.Add(_main); _stopwatch = ValueStopwatch.StartNew(); } return(this); }
/// <summary> /// Logs the start of the execution. /// </summary> /// <param name="operationName">The name of the GraphQL operation.</param> public Metrics Start(string operationName) { if (Enabled) { if (_main != null) { throw new InvalidOperationException("Metrics.Start has already been called"); } _main = new PerfRecord("operation", operationName, 0); _records.Add(_main); _stopwatch = ValueStopwatch.StartNew(); } return(this); }
public Marker Subject(string category, string subject, Dictionary <string, object> metadata = null) { if (!_enabled) { return(Marker.Empty); } if (_main == null) { throw new InvalidOperationException("Metrics.Start should be called before calling Metrics.Subject"); } var record = new PerfRecord(category, subject, _stopwatch.Elapsed.TotalMilliseconds, metadata); _records.Add(record); return(new Marker(record, _stopwatch)); }
public Marker(PerfRecord record, ValueStopwatch stopwatch) { _record = record; _stopwatch = stopwatch; }