示例#1
0
        /// <summary>
        /// Benchmark thread
        /// </summary>
        private void BenchmarkThread()
        {
            Thread.Sleep(2000);

            try {
                OnPaintTimeStatistics onPaintStats = new OnPaintTimeStatistics();
                _session.TerminalControl.SetOnPaintTimeObserver(
                    delegate(Stopwatch s) {
                    onPaintStats.Update(s);
                }
                    );

                SockWriteLine("Start XTerm Benchmark.");

                Stopwatch swTotal = Stopwatch.StartNew();

                const int DATA_CHUNK_SIZE = 200;

                for (int i = 0; i < _repeat; i++)
                {
                    _socket.FeedData(BenchmarkDataGenerator(DATA_CHUNK_SIZE), TIMEOUT);
                }

                swTotal.Stop();

                SockWriteLine("End XTerm Benchmark.");

                _session.TerminalControl.SetOnPaintTimeObserver(null);

                TerminalDocument doc = (TerminalDocument)_session.Terminal.IDocument.GetAdapter(typeof(TerminalDocument));

                SockWriteLine("---------------------------------------");
                SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo,
                                            "Terminal Size : {0} x {1}", doc.TerminalWidth, doc.TerminalHeight));
                SockWriteLine(String.Format(NumberFormatInfo.InvariantInfo,
                                            "Terminal Buffer Size : {0}", _options.TerminalBufferSize));
                SockWriteLine("---------------------------------------");
                SockWriteLine(String.Format("OnPaint {0} samples", onPaintStats.GetSampleCount()));
                SockWriteLine(String.Format("        Max  {0} msec", onPaintStats.GetMaxTimeMilliseconds()));
                SockWriteLine(String.Format("        Min  {0} msec", onPaintStats.GetMinTimeMilliseconds()));
                SockWriteLine(String.Format("        Avg  {0} msec", onPaintStats.GetAverageTimeMilliseconds()));
                SockWriteLine("---------------------------------------");
                ReportBenchmark("Total          ", swTotal);
                SockWriteLine("---------------------------------------");
            }
            catch (MockSocketTimeoutException) {
            }
        }
示例#2
0
 private void SockWriteLine()
 {
     _socket.FeedData(new byte[][] { Encoding.UTF8.GetBytes(NEWLINE) }, TIMEOUT);
 }