Пример #1
0
        public IStopwatch CreateAndStore(MeasuredOperation operation, bool outputToConsole = false)
        {
            var stopwatch = Create(operation, outputToConsole);

            cachedStopwatches[operation] = stopwatch;

            return(stopwatch);
        }
Пример #2
0
            public AndroidFirebaseStopwatch(MeasuredOperation operation)
            {
                Operation = operation;

                #if USE_ANALYTICS
                firebaseTrace = FirebasePerformance.Instance.NewTrace(operation.ToString());
                #endif
            }
Пример #3
0
        public IStopwatch Create(MeasuredOperation operation, bool outputToConsole = false)
        {
            var stopwatch = NativeCreate(operation);

            return(outputToConsole
                ? new ConsoleStopwatch(stopwatch)
                : new SingleUseStopwatch(stopwatch));
        }
Пример #4
0
        public IStopwatch Get(MeasuredOperation operation)
        {
            if (cachedStopwatches.TryGetValue(operation, out var stopwatch))
            {
                return(stopwatch);
            }

            return(null);
        }
Пример #5
0
 protected abstract IStopwatch NativeCreate(MeasuredOperation operation);
Пример #6
0
 public void Remove(MeasuredOperation operation)
 {
     cachedStopwatches.Remove(operation);
 }
Пример #7
0
 protected override IStopwatch NativeCreate(MeasuredOperation operation)
 => new AndroidFirebaseStopwatch(operation);
 public IosFirebaseStopwatch(MeasuredOperation operation)
 {
     Operation = operation;
 }
Пример #9
0
 public DummyStopwatch(MeasuredOperation operation)
 {
     Operation = operation;
 }
Пример #10
0
 protected override IStopwatch NativeCreate(MeasuredOperation operation)
 => new DummyStopwatch(operation);
Пример #11
0
        public static IStopwatch MaybeCreateStopwatch(this IStopwatchProvider stopwatchProvider, MeasuredOperation operation, float probability)
        {
            var samplingFactor = samplingRandom.NextDouble();

            if (samplingFactor <= probability)
            {
                return(stopwatchProvider.Create(operation));
            }

            return(null);
        }