public IStopwatch CreateAndStore(MeasuredOperation operation, bool outputToConsole = false) { var stopwatch = Create(operation, outputToConsole); cachedStopwatches[operation] = stopwatch; return(stopwatch); }
public AndroidFirebaseStopwatch(MeasuredOperation operation) { Operation = operation; #if USE_ANALYTICS firebaseTrace = FirebasePerformance.Instance.NewTrace(operation.ToString()); #endif }
public IStopwatch Create(MeasuredOperation operation, bool outputToConsole = false) { var stopwatch = NativeCreate(operation); return(outputToConsole ? new ConsoleStopwatch(stopwatch) : new SingleUseStopwatch(stopwatch)); }
public IStopwatch Get(MeasuredOperation operation) { if (cachedStopwatches.TryGetValue(operation, out var stopwatch)) { return(stopwatch); } return(null); }
protected abstract IStopwatch NativeCreate(MeasuredOperation operation);
public void Remove(MeasuredOperation operation) { cachedStopwatches.Remove(operation); }
protected override IStopwatch NativeCreate(MeasuredOperation operation) => new AndroidFirebaseStopwatch(operation);
public IosFirebaseStopwatch(MeasuredOperation operation) { Operation = operation; }
public DummyStopwatch(MeasuredOperation operation) { Operation = operation; }
protected override IStopwatch NativeCreate(MeasuredOperation operation) => new DummyStopwatch(operation);
public static IStopwatch MaybeCreateStopwatch(this IStopwatchProvider stopwatchProvider, MeasuredOperation operation, float probability) { var samplingFactor = samplingRandom.NextDouble(); if (samplingFactor <= probability) { return(stopwatchProvider.Create(operation)); } return(null); }