Source/NFX/Instrumentation/InstrumentationService.cs
/// <summary>
/// Returns samples starting around the the specified UTCdate 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
/// </summary>
Returns samples starting around the the specified UTCdate 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
Returns samples starting around the the specified UTCdate 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
public IEnumerable<Datum> GetBufferedResultsSince(DateTime utcStart)
            {
              const int COARSE_SEC_SAMPLES = 50;
              const int FINE_SEC_SAMPLES = 10;
              var data = m_ResultBuffer;
              if (data==null) yield break;
              var curIdx = m_ResultBufferIndex;
              if (curIdx>=data.Length) curIdx = 0;
              var taking = false;
              var idx = curIdx;
              for(int pass=0;pass<2;pass++)
              {
                while(idx< (pass==0 ? data.Length : curIdx))
                {
                  var datum = data[idx];
                  if (datum==null)
                  {
                    idx += taking ? 1 : COARSE_SEC_SAMPLES;
                    continue;
                  }
                  if (taking)
                  {
                    if (datum.UTCTime >= utcStart)
                     yield return datum;
                    idx++;
                    continue;
                  }
                  if (datum.UTCTime>=utcStart)
                  {
                    taking = true;
                    continue;
                  }
                  var span = (int)(utcStart - datum.UTCTime).TotalSeconds;
                  var offset = span<5 ? 1 : span<10 ? FINE_SEC_SAMPLES : span * COARSE_SEC_SAMPLES;
                  idx += offset;
                }
                idx=0;
              }
            }
public IEnumerable < Datum > GetBufferedResultsSince ( DateTime utcStart ) { const int COARSE_SEC_SAMPLES = 50 ; const int FINE_SEC_SAMPLES = 10 ; var data = m_ResultBuffer ; if ( data == null ) yield break ; var curIdx = m_ResultBufferIndex ; if ( curIdx >= data . Length ) curIdx = 0 ; var taking = false ; var idx = curIdx ; for ( int pass = 0 ; pass < 2 ; pass ++ ) { while ( idx < ( pass == 0 ? data . Length : curIdx ) ) { var datum = data [ idx ] ; if ( datum == null ) { idx += taking ? 1 : COARSE_SEC_SAMPLES ; continue ; } if ( taking ) { if ( datum . UTCTime >= utcStart ) yield return datum ; idx ++ ; continue ; } if ( datum . UTCTime >= utcStart ) { taking = true ; continue ; } var span = ( int ) ( utcStart - datum . UTCTime ) . TotalSeconds ; var offset = span < 5 ? 1 : span < 10 ? FINE_SEC_SAMPLES : span * COARSE_SEC_SAMPLES ; idx += offset ; } idx = 0 ; } }
Returns samples starting around the the specified UTCdate 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 samples starting around the the specified UTCdate 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 //capture the tail first //0=tail, 1=head, 2...exit //can not be negative because of prior if //while //for
utcStart
DateTime