コード例 #1
0
        /// <summary>
        /// Get the value since the last <see cref="M:ExitGames.Diagnostics.Counter.CountsPerSecondCounter.GetNextValue"/> call.
        /// </summary>
        /// <returns>A new <see cref="T:ExitGames.Diagnostics.Counter.RawCounterSample"/>.</returns>
        /// <remarks>This method is NOT thread safe.</remarks>
        public override float GetNextValue()
        {
            RawCounterSample sample     = this.oldSample;
            RawCounterSample nextSample = this.GetNextSample();

            this.oldSample = nextSample;
            long num  = nextSample.TimeStamp - sample.TimeStamp;
            long num2 = nextSample.Value - sample.Value;

            if (num == 0L)
            {
                return(0f);
            }
            return((float)num2 / (float)num / (float)Stopwatch.Frequency);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExitGames.Diagnostics.Counter.CountsPerSecondCounter"/> class.
 /// </summary>
 /// <param name="counterName">The counterName.</param>
 public CountsPerSecondCounter(string counterName)
     : base(counterName)
 {
     this.sharedCounter = new SharedCounter(counterName);
     this.oldSample     = this.GetNextSample();
 }