Exemplo n.º 1
0
            // FlushBuffer needs mtx AND bufMtx locked.
            private void FlushBuffer(DateTime now)
            {
                for (int bufIdx = 0; bufIdx < _buffer.Position; bufIdx++)
                {
                    double value = _buffer[bufIdx];

                    foreach (var quantileStream in _streams)
                    {
                        quantileStream.Insert(value);
                    }

                    _count++;
                    _sum += value;
                }

                _buffer.Reset();

                // buffer is now empty and gets new expiration set.
                while (now > _bufferExpTime)
                {
                    _bufferExpTime = _bufferExpTime.Add(_streamDuration);
                }

                MaybeRotateStreams();
            }
Exemplo n.º 2
0
        protected void Recycle(SampleBuffer buffer)
        {
            buffer.Reset();

            if (this.bufferPool != null)
            {
                this.bufferPool.Push(buffer);
            }
        }
Exemplo n.º 3
0
            // FlushColdBuf needs mtx locked.
            private void FlushColdBuf()
            {
                for (var bufIdx = 0; bufIdx < _coldBuf.Position; bufIdx++)
                {
                    var value = _coldBuf[bufIdx];

                    foreach (var quantileStream in _streams)
                    {
                        quantileStream.Insert(value);
                    }

                    _count++;
                    _sum += value;
                }

                _coldBuf.Reset();
                MaybeRotateStreams();
            }
Exemplo n.º 4
0
            // FlushColdBuf needs mtx locked.
            private void FlushColdBuf()
            {
                for (var bufIdx = 0; bufIdx < _coldBuf.Position; bufIdx++)
                {
                    var value = _coldBuf[bufIdx];

                    for (var streamIdx = 0; streamIdx < _streams.Length; streamIdx++)
                    {
                        _streams[streamIdx].Insert(value);
                    }

                    _count++;
                    _sum += value;
                }

                _coldBuf.Reset();
                MaybeRotateStreams();
            }