Exemple #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) {
            }
        }
        /// <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) {
            }
        }
Exemple #3
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.");

                const int DATA_CHUNK_SIZE = 200;

                const int TRANSMIT_SECONDS = 30;

                DateTime utcLimit = DateTime.UtcNow.AddSeconds(TRANSMIT_SECONDS);

                Stopwatch swTotal;

                switch (_pattern)
                {
                case XTermBenchmarkPattern.ASCII:
                    swTotal = BenchmarkAscii(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.KANJI:
                    swTotal = BenchmarkKanji(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.ASCII_KANJI:
                    swTotal = BenchmarkAsciiKanji(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.ASCII_COLOR16:
                    swTotal = BenchmarkAsciiColor16(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.KANJI_COLOR16:
                    swTotal = BenchmarkKanjiColor16(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.ASCII_KANJI_COLOR16:
                    swTotal = BenchmarkAsciiKanjiColor16(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.ASCII_COLOR256:
                    swTotal = BenchmarkAsciiColor256(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.KANJI_COLOR256:
                    swTotal = BenchmarkKanjiColor256(DATA_CHUNK_SIZE, utcLimit);
                    break;

                case XTermBenchmarkPattern.ASCII_KANJI_COLOR256:
                    swTotal = BenchmarkAsciiKanjiColor256(DATA_CHUNK_SIZE, utcLimit);
                    break;

                default:
                    swTotal = Stopwatch.StartNew();
                    swTotal.Stop();
                    break;
                }

                SockWriteLine("\u001b[0m");
                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) {
            }
        }
        /// <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.");

                const int DATA_CHUNK_SIZE = 200;

                const int TRANSMIT_SECONDS = 30;

                DateTime utcLimit = DateTime.UtcNow.AddSeconds(TRANSMIT_SECONDS);

                Stopwatch swTotal;

                switch (_pattern) {
                    case XTermBenchmarkPattern.ASCII:
                        swTotal = BenchmarkAscii(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.KANJI:
                        swTotal = BenchmarkKanji(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.ASCII_KANJI:
                        swTotal = BenchmarkAsciiKanji(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.ASCII_COLOR16:
                        swTotal = BenchmarkAsciiColor16(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.KANJI_COLOR16:
                        swTotal = BenchmarkKanjiColor16(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.ASCII_KANJI_COLOR16:
                        swTotal = BenchmarkAsciiKanjiColor16(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.ASCII_COLOR256:
                        swTotal = BenchmarkAsciiColor256(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.KANJI_COLOR256:
                        swTotal = BenchmarkKanjiColor256(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    case XTermBenchmarkPattern.ASCII_KANJI_COLOR256:
                        swTotal = BenchmarkAsciiKanjiColor256(DATA_CHUNK_SIZE, utcLimit);
                        break;
                    default:
                        swTotal = Stopwatch.StartNew();
                        swTotal.Stop();
                        break;
                }

                SockWriteLine("\u001b[0m");
                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) {
            }
        }