Esempio n. 1
0
        // #############################################################################################
        // Interface to Measurement
        // #############################################################################################

        /** ****************************************************************************************
         * Returns the time span between the current system time and the internal reference value.
         * In addition this value is added to the sum of sample times and the sample counter is
         * increased by one. Lastly the internal reference value is set to now. Therefore, a
         * subsequent call to this function would measure the time span from this call to this
         * subsequent call (if the internal reference value was not set differently meanwhile).
         * Other interface methods dealing with samples are #GetSampleCnt, #GetCumulated and
         * #GetAverage.
         *
         * @return  The time difference between the current system time and the internal reference value.
         ******************************************************************************************/
        public Ticks    Sample()
        {
            if (tempTicks == null)
            {
                tempTicks = new Ticks(0L);
            }

            cntSamples++;
            long old = ticks.Raw();

            ticks.Set();
            long diff = ticks.Raw() - old;

            tempTicks.SetRaw(diff);
            sum.Add(diff);

            return(tempTicks);
        }
Esempio n. 2
0
 /** ****************************************************************************************
  * Sets the internal value to current system time and clears existing sum and quantity of
  * samples.
  ******************************************************************************************/
 public void     Reset()
 {
     sum.SetRaw(0L); cntSamples = 0;  Start();
 }