Source/NFX/Instrumentation/InstrumentationService.cs
/// <summary>
/// Returns the specified number of samples from the ring result buffer in the near-chronological order,
/// meaning that data is already sorted by time MOST of the TIME, however sorting is NOT GUARANTEED for all
///  result records returned as enumeration is a lazy procedure that does not make copies/take locks.
/// The enumeration is empty if ResultBufferSize is less or equal to zero entries.
/// If count is less or equal to zero then the system returns all results available.
/// </summary>
Returns the specified number of samples from the ring result buffer in the near-chronological order,
meaning that data is already sorted by time MOST of the TIME, however sorting is NOT GUARANTEED for all
result records returned as enumeration is a lazy procedure that does not make copies/take locks.
The enumeration is empty if ResultBufferSize is less or equal to zero entries.
If count is less or equal to zero then the system returns all results available.
Returns the specified number of samples from the ring result buffer in the near - chronological order meaning that data is already sorted by time MOST of the TIME however sorting is NOT GUARANTEED for all result records returned as enumeration is a lazy procedure that does not make copies / take locks . The enumeration is empty if ResultBufferSize is less or equal to zero entries . If count is less or equal to zero then the system returns all results available .
public IEnumerable<Datum> GetBufferedResults(int count=0)
            {
              var data = m_ResultBuffer;
              if (data==null) yield break;
              var curIdx = m_ResultBufferIndex;
              if (curIdx>=data.Length) curIdx = 0;
              var idx = curIdx + 1;
              if (count>0)
              {
                if (count>m_ResultBufferSize) count = m_ResultBufferSize;
                if (curIdx>=count)
                  idx = curIdx - count;
                else
                  idx = (data.Length-1) - ((count-1) - curIdx);
              }
              if (idx>=curIdx)
              {
                for(;idx<data.Length;idx++)
                {
                   var datum = data[idx];
                   if (datum!=null) yield return datum;
                }
                idx = 0;
              }
              for(;idx<curIdx;idx++)
              {
                 var datum = data[idx];
                 if (datum!=null) yield return datum;
              }
            }
public IEnumerable < Datum > GetBufferedResults ( int count = 0 ) { var data = m_ResultBuffer ; if ( data == null ) yield break ; var curIdx = m_ResultBufferIndex ; if ( curIdx >= data . Length ) curIdx = 0 ; var idx = curIdx + 1 ; if ( count > 0 ) { if ( count > m_ResultBufferSize ) count = m_ResultBufferSize ; if ( curIdx >= count ) idx = curIdx - count ; else idx = ( data . Length - 1 ) - ( ( count - 1 ) - curIdx ) ; } if ( idx >= curIdx ) { for ( ; idx < data . Length ; idx ++ ) { var datum = data [ idx ] ; if ( datum != null ) yield return datum ; } idx = 0 ; } for ( ; idx < curIdx ; idx ++ ) { var datum = data [ idx ] ; if ( datum != null ) yield return datum ; } }
Returns the specified number of samples from the ring result buffer in the near-chronological order,
meaning that data is already sorted by time MOST of the TIME, however sorting is NOT GUARANTEED for all
result records returned as enumeration is a lazy procedure that does not make copies/take locks.
Returns the specified number of samples from the ring result buffer in the near - chronological order meaning that data is already sorted by time MOST of the TIME however sorting is NOT GUARANTEED for all result records returned as enumeration is a lazy procedure that does not make copies / take locks .
//thread-safe copy //else dump all //capture the tail first
count
int