Exemplo n.º 1
0
        /// <summary>Measures the rule execution time and adds this sample to performance counter.</summary>
        /// <param name="rule">Rule being measured.</param>
        /// <returns><see cref="IDisposable"/> that should be disposed after rule has finished it's execution.</returns>
        public IDisposable MeasureRuleExecutionTime(IConsensusRuleBase rule)
        {
            var stopwatch = new StopwatchDisposable(elapsedTicks =>
            {
                this.currentSnapshot.PerformanceInfo[rule].AddTicks(elapsedTicks);
            });

            return(stopwatch);
        }
Exemplo n.º 2
0
        /// <summary>Measures the rule execution time and adds this sample to performance counter.</summary>
        /// <param name="rule">Rule being measured.</param>
        /// <returns><see cref="IDisposable"/> that should be disposed after rule has finished it's execution.</returns>
        public IDisposable MeasureRuleExecutionTime(IConsensusRuleBase rule)
        {
            var stopwatch = new StopwatchDisposable(elapsedTicks =>
            {
                RulePerformance performance = this.currentSnapshot.PerformanceInfo[rule];

                Interlocked.Increment(ref performance.CalledTimes);
                Interlocked.Add(ref performance.ExecutionTimesTicks, elapsedTicks);
            });

            return(stopwatch);
        }
Exemplo n.º 3
0
        public IDisposable MeasureBlockDisconnectedSignal()
        {
            var stopwatch = new StopwatchDisposable(elapsedTicks =>
            {
                ConsensusManagerPerformanceSnapshot snapshot = this.currentSnapshot;

                Interlocked.Increment(ref snapshot.BlockDisconnectedSignal.TotalExecutionsCount);
                Interlocked.Add(ref snapshot.BlockDisconnectedSignal.TotalDelayTicks, elapsedTicks);
            });

            return(stopwatch);
        }
Exemplo n.º 4
0
    void Start()
    {
        _spriteManager = FindObjectOfType <SpriteManager>();
        _audioSource   = GetComponent <AudioSource>();

        _timeManager.Time = 0;
        _timeManager.Tick = 0;

        //この時点で曲が確定している
        using (var watch = new StopwatchDisposable())
        {
            _boardCreator.Setup(musicXmlText: _musicXMLData.text);
        }

        _timeManager.Tempo = _boardCreator.GameScore.Tempo ?? Const.DefaultTempo;

        StartParts();
        _audioSource.Play();

        Debug.Log($"NoteXAdjustment:{Const.NoteXAdjustment}, move:{Const.MovePointInTick}");
    }