Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public void Start(string operationName)
 {
     _main = new PerfRecord("operation", operationName, 0);
     lock (_lock)
     {
         _records.Add(_main);
     }
     _stopwatch.Start();
 }
Exemplo n.º 3
0
        public void Start(string operationName)
        {
            if (!_enabled)
            {
                return;
            }

            _main = new PerfRecord("operation", operationName, 0);
            _records.Add(_main);
            _stopwatch.Start();
        }
Exemplo n.º 4
0
        public Metrics Start(string operationName)
        {
            if (_enabled)
            {
                _main = new PerfRecord("operation", operationName, 0);
                _records.Add(_main);
                _stopwatch = ValueStopwatch.StartNew();
            }

            return(this);
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
 public Marker(PerfRecord record, ValueStopwatch stopwatch)
 {
     _record    = record;
     _stopwatch = stopwatch;
 }