Пример #1
0
        public CodingDojo(IStopwatch stopwatch, IKombatSoundPlayer soundPlayer, ISession session)
        {
            _stopwatch = stopwatch;
            _soundPlayer = soundPlayer;
            _session = session;

            CycleTimes = new List<TimeSpan>();
        }
Пример #2
0
        public Timing(IStopwatch watch)
        {
            if (watch == null)
                throw new ArgumentNullException("watch");

            this.watch = watch;
            this.startTicks = watch.ElapsedTicks;
        }
 public MethodPerformanceAdvisor(IStopwatch stopwatch, 
     IGlimpsePerformanceConfiguration glimpsePerformanceConfiguration,
     IStorageFactory storageFactory,
     IConversionHelper conversionHelper)
 {
     GlimpsePerformanceConfiguration = glimpsePerformanceConfiguration;
     Stopwatch = stopwatch;
     StorageFactory = storageFactory;
     Stopwatch.Start();
     ConversionHelper = conversionHelper;
 }
Пример #4
0
        public MicroProfiler(string name = null, IStopwatch stopwatch = null, ITarget target = null, Settings settings = null)
        {
            Name = name;
            if (settings == null)
                settings = Config.DefaultSettings;

            _stopwatch = stopwatch ?? settings.StopwatchInstance ?? Activator.CreateInstance(settings.StopwatchType) as IStopwatch;
            _target = target ?? settings.TargetInstance ?? Activator.CreateInstance(settings.TargetType) as ITarget;

            Start();
        }
Пример #5
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MiniProfiler"/> class. 
        /// Creates and starts a new MiniProfiler for the root <paramref name="url"/>, filtering <see cref="Timing"/> steps to <paramref name="level"/>.
        /// </summary>
        /// <param name="url">
        /// The URL.
        /// </param>
        /// <param name="level">
        /// The level.
        /// </param>
        public MiniProfiler(string url, ProfileLevel level = ProfileLevel.Info)
        {
            Id = Guid.NewGuid();
            Level = level;
            SqlProfiler = new SqlProfiler(this);
            MachineName = Environment.MachineName;
            Started = DateTime.UtcNow;

            // stopwatch must start before any child Timings are instantiated
            _sw = Settings.StopwatchProvider();
            Root = new Timing(this, null, url);
        }
Пример #6
0
        /// <summary>
        /// Initialises a new instance of the <see cref="MiniProfiler"/> class.  Creates and starts a new MiniProfiler 
        /// for the root <paramref name="url"/>.
        /// </summary>
        public MiniProfiler(string url)
        {
            Id = Guid.NewGuid();
            #pragma warning disable 612,618
            Level = ProfileLevel.Info;
            #pragma warning restore 612,618
            SqlProfiler = new SqlProfiler(this);
            MachineName = Environment.MachineName;
            Started = DateTime.UtcNow;

            // stopwatch must start before any child Timings are instantiated
            _sw = Settings.StopwatchProvider();
            Root = new Timing(this, null, url);
        }
Пример #7
0
        internal MetricsPipe(GraphiteConfiguration configuration, IMetricsPipeProvider provider, Func<IStopwatch> watch)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            if (provider == null)
                throw new ArgumentNullException("provider");

            if (watch == null)
                throw new ArgumentNullException("watch");

            this.factory = new ChannelFactory(configuration.Graphite, configuration.StatsD);

            MetricsPipe.provider = provider;

            this.watch = watch();
        }
Пример #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DotvvmPresenter" /> class.
 /// </summary>
 public DotvvmPresenter(DotvvmConfiguration configuration, IDotvvmViewBuilder viewBuilder, IViewModelLoader viewModelLoader, IViewModelSerializer viewModelSerializer,
                        IOutputRenderer outputRender, ICsrfProtector csrfProtector, IStopwatch stopwatch, IViewModelParameterBinder viewModelParameterBinder)
 {
     DotvvmViewBuilder        = viewBuilder;
     ViewModelLoader          = viewModelLoader;
     ViewModelSerializer      = viewModelSerializer;
     OutputRenderer           = outputRender;
     CsrfProtector            = csrfProtector;
     ViewModelParameterBinder = viewModelParameterBinder;
     ApplicationPath          = configuration.ApplicationPhysicalPath;
 }
Пример #9
0
 public AsyncDetector([NotNull] IStopwatch stopwatch)
 {
     _runtimes  = new ConcurrentBag <AsyncScope>();
     _stopwatch = stopwatch ?? throw new ArgumentNullException(nameof(stopwatch));
     _stopwatch.Start();
 }
Пример #10
0
                public void Run(IObservable <TSource> source, IScheduler scheduler)
                {
                    _watch = scheduler.StartStopwatch();

                    Run(source);
                }
Пример #11
0
 public RateLimiter(int limit, TimeSpan decreaseTime, IStopwatch stopwatch)
 {
     _counterLimit        = limit;
     _counterDecreaseTime = decreaseTime;
     _stopwatch           = stopwatch;
 }
 public ProfilingComponent(IComponent decoratedComponent, IStopwatch stopwatch)
 {
     this.decoratedComponent = decoratedComponent;
     this.stopwatch = stopwatch;
 }
Пример #13
0
 public FakeTimeProvider(DateTime now, IStopwatch stopwatch)
 {
     _now = now;
     _stopwatch = stopwatch;
 }
 public void Setup()
 {
     _stopwatch = MockRepository.GenerateStub<IStopwatch>();
     _soundPlayer = MockRepository.GenerateStub<IKombatSoundPlayer>();
     _session = MockRepository.GenerateStub<ISession>();
     _target = new CodingDojo(_stopwatch, _soundPlayer, _session);
 }
Пример #15
0
 public ProfilingComponent(IComponent decoratedComponent, IStopwatch stopwatch)
 {
     this.decoratedComponent = decoratedComponent;
     this.stopwatch          = stopwatch;
 }
Пример #16
0
 public ProfilingComponent(IComponent decoratedComponent, IStopwatch stopwatch)
 {
     _decoratedComponent = decoratedComponent;
     _stopwatch = stopwatch;
 }
Пример #17
0
 public Entry(T value, IStopwatch lifetime)
 {
     Value    = value;
     Lifetime = lifetime;
 }
Пример #18
0
 public PerformanceBehaviour(IStopwatch stopwatch, ILogger <TRequest> logger)
 {
     _stopwatch = stopwatch;
     _logger    = logger;
 }
Пример #19
0
 public FakeTimeProvider(DateTime now)
 {
     _now = now;
     _stopwatch = new Stopwatch(_now);
 }
Пример #20
0
 public TimeTarget(IStopwatch stopwatch)
 {
     _stopWatch = stopwatch;
 }
Пример #21
0
 public static bool TryCreateActive(TimeInterval timeInterval, IStopwatch stopwatch, out TimeToLive timeToLive)
 {
     if (timeInterval <= stopwatch.Elapsed)
     {
         timeToLive = default !;
Пример #22
0
 public TimeService(IStopwatch stopwatch, ITimer timer)
 {
     _stopwatch = stopwatch;
     _timer     = timer;
 }
Пример #23
0
 public void Setup()
 {
     _timer       = Substitute.For <ITimer>();
     _stopwatch   = Substitute.For <IStopwatch>();
     _timeService = new TimeService(_stopwatch, _timer);
 }
Пример #24
0
            public IDisposable Run()
            {
                _watch = _parent._scheduler.StartStopwatch();

                return(_parent._source.SubscribeSafe(this));
            }
Пример #25
0
 public static bool HasPassed(this IStopwatch stopwatch, TimeInterval amount) =>
 amount - stopwatch.Elapsed /*- stopwatch.Precision*/ <= TimeSpan.Zero;
Пример #26
0
 public override void ViewAppeared()
 {
     base.ViewAppeared();
     navigationFromMainViewModelStopwatch?.Stop();
     navigationFromMainViewModelStopwatch = null;
 }
Пример #27
0
 public ConsoleStopwatch(IStopwatch innerStopwatch)
     : base(innerStopwatch)
 {
 }
Пример #28
0
 public StopwatchService(IStopwatch stopwatch)
 {
     this.stopwatch = stopwatch;
 }
Пример #29
0
 public SingleUseStopwatch(IStopwatch innerStopwatch)
 {
     InnerStopwatch = innerStopwatch;
     Operation      = innerStopwatch.Operation;
 }
Пример #30
0
                public void Run(Time parent)
                {
                    _watch = parent._scheduler.StartStopwatch();

                    SetUpstream(parent._source.SubscribeSafe(this));
                }
Пример #31
0
 public IConfigure MeasureExecutionTime(IStopwatch stopwatch) => MeasureExecutionTime(Optional.From(stopwatch));
Пример #32
0
 public JobQueue(IStopwatch stopwatch)
 {
     _stopwatch = stopwatch;
 }
Пример #33
0
 public StopWatchDecorator(IStopwatch stopwatch)
 {
     _stopwatch = stopwatch;
 }
Пример #34
0
 public LongJobQueue(IStopwatch swB) : base(swB)
 {
 }
Пример #35
0
 public KdTreeRenderer(IProgressBar progressBar, IStopwatch stopwatch, IRayProvider rayProvider)
 {
     this.progressBar = progressBar;
     this.stopwatch   = stopwatch;
     this.rayProvider = rayProvider;
 }
 public LoggingStopwatch(IStopwatch decoratedStopwatch)
 {
     this.decoratedStopwatch = decoratedStopwatch;
 }
Пример #37
0
 public void Run()
 {
     _watch = _parent._scheduler.StartStopwatch();
     Disposable.SetSingle(ref _sourceDisposable, _parent._source.SubscribeSafe(this));
 }
Пример #38
0
 public AsyncScope(IStopwatch stopwatch, Action <AsyncScope> dispose)
 {
     _stopwatch = stopwatch;
     _dispose   = dispose;
     Interval   = Range.Create(_stopwatch.Elapsed);
 }
Пример #39
0
 public CreateAccessToken()
 {
     stopwatchFactory = Substitute.For <IStopwatchFactory>();
     stopwatch        = Substitute.For <IStopwatch>();
     stopwatchFactory.Start().Returns(stopwatch);
 }
Пример #40
0
 public OutputProcessorWithKeepAlive(MqttClientConfiguration config, OutputPump outputPump, PipeWriter pipeWriter, IOutgoingPacketStore store)
     : base(outputPump, pipeWriter, store)
 {
     _config    = config;
     _stopwatch = config.StopwatchFactory.Create();
 }
Пример #41
0
        private long AddTraceData(long lastStopwatchState, string eventName, IDotvvmRequestContext context, IStopwatch stopwatch)
        {
            long nextStopwatchState = stopwatch.GetElapsedMiliseconds();

            context.TraceData.Add(eventName, nextStopwatchState - lastStopwatchState);
            return(nextStopwatchState);
        }
Пример #42
0
 public SessionFactory(AbstractLogger logger, ICoroutineManager coroutineManager, IStopwatch pollCountdownStopwatch, IEpochTime epochTime, DatabaseCorruptionHandler databaseCorruptionHandler, INotificationQueue notificationQueue, INotificationDispatcher notificationDispatcher, ISessionStatus sessionStatus, IMixWebCallFactoryFactory mixWebCallFactoryFactory, IWebCallEncryptorFactory webCallEncryptorFactory, IMixSessionStarter mixSessionStarter, IKeychain keychain, ISessionRefresherFactory sessionRefresherFactory, IGuestControllerClientFactory guestControllerClientFactory, IRandom random, IEncryptor encryptor, IFileSystem fileSystem, IWwwCallFactory wwwCallFactory, string localStorageDirPath, string clientVersion, IDatabaseDirectoryCreator databaseDirectoryCreator, IDocumentCollectionFactory documentCollectionFactory, IDatabase database)
 {
     this.logger                       = logger;
     this.coroutineManager             = coroutineManager;
     this.pollCountdownStopwatch       = pollCountdownStopwatch;
     this.epochTime                    = epochTime;
     this.databaseCorruptionHandler    = databaseCorruptionHandler;
     this.notificationQueue            = notificationQueue;
     this.notificationDispatcher       = notificationDispatcher;
     this.sessionStatus                = sessionStatus;
     this.mixWebCallFactoryFactory     = mixWebCallFactoryFactory;
     this.webCallEncryptorFactory      = webCallEncryptorFactory;
     this.mixSessionStarter            = mixSessionStarter;
     this.keychain                     = keychain;
     this.sessionRefresherFactory      = sessionRefresherFactory;
     this.guestControllerClientFactory = guestControllerClientFactory;
     this.random                       = random;
     this.encryptor                    = encryptor;
     this.fileSystem                   = fileSystem;
     this.wwwCallFactory               = wwwCallFactory;
     this.localStorageDirPath          = localStorageDirPath;
     this.clientVersion                = clientVersion;
     this.databaseDirectoryCreator     = databaseDirectoryCreator;
     this.documentCollectionFactory    = documentCollectionFactory;
     this.database                     = database;
 }
 public ApplicationInsightsBulkTracer(TelemetryClient telemetryClient, IStopwatch stopwatch)
 {
     this.telemetryClient = telemetryClient;
     this.stopwatch       = stopwatch;
 }
Пример #44
0
 public TimeTarget()
 {
     _stopWatch = StopwatchWrapper.StartNew();
 }
Пример #45
0
 public override void ViewAppeared()
 {
     base.ViewAppeared();
     navigationFromEditTimeEntryViewModelStopwatch?.Stop();
     navigationFromEditTimeEntryViewModelStopwatch = null;
 }
Пример #46
0
 public StopwatchTests()
 {
     ticker = new FakeTicker();
     stopwatch = Stopwatches.Create(ticker);
 }
 static MethodPerformanceAdvisor()
 {
     Stopwatch = new Stopwatch();
     Stopwatch.Start();
 }