예제 #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();
 }