예제 #1
0
    public void PlatfromBenchmarkPlaintext()
    {
        s_sink.Reset();
        var writer = new PlatfromBenchmark.BufferWriter <Sink>(s_sink);

        // HTTP 1.1 OK
        writer.Write(s_http11OK);

        // Server headers
        writer.Write(s_headerServer);

        // Date header
        writer.Write(DateHeader.HeaderBytes);

        // Content-Type header
        writer.Write(s_headerContentTypeText);

        // Content-Length header
        writer.Write(s_headerContentLength);
        writer.Write((ulong)s_plainTextBody.Length);

        // End of headers
        writer.Write(s_eoh);

        // Body
        writer.Write(s_plainTextBody);
        writer.Commit();
    }
예제 #2
0
    static void PlatfromBenchmarkPlaintext()
    {
        foreach (var iteration in Benchmark.Iterations)
        {
            using (iteration.StartMeasurement())
            {
                for (int i = 0; i < InnerIterations; i++)
                {
                    s_sink.Reset();
                    var writer = new PlatfromBenchmark.BufferWriter <Sink>(s_sink);

                    // HTTP 1.1 OK
                    writer.Write(s_http11OK);

                    // Server headers
                    writer.Write(s_headerServer);

                    // Date header
                    writer.Write(DateHeader.HeaderBytes);

                    // Content-Type header
                    writer.Write(s_headerContentTypeText);

                    // Content-Length header
                    writer.Write(s_headerContentLength);
                    writer.Write((ulong)s_plainTextBody.Length);

                    // End of headers
                    writer.Write(s_eoh);

                    // Body
                    writer.Write(s_plainTextBody);
                    writer.Commit();
                }
            }
        }
    }