예제 #1
0
                protected async Task YFlushAsync(cMethodControl pMC, cBatchSizer pWriteSizer, cTrace.cContext pContext)
                {
                    if (mCount == 0)
                    {
                        return;
                    }

                    pContext.TraceVerbose("writing {0} bytes to stream", mCount);

                    mStopwatch.Restart();
                    await mStream.WriteAsync(mBuffer, 0, mCount, pMC.CancellationToken).ConfigureAwait(false);

                    mStopwatch.Stop();

                    // store the time taken so the next write is a better size
                    pWriteSizer.AddSample(mCount, mStopwatch.ElapsedMilliseconds);

                    mCount = 0;
                }