From 1bdff3175c03ce5c9fb8b44ee28d6ec7b3db8de5 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 30 Jul 2020 23:45:28 -0300 Subject: [PATCH] Adding performance tests. --- client/src/testprogram/testprogram.cc | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/client/src/testprogram/testprogram.cc b/client/src/testprogram/testprogram.cc index e8eab7a..ba54cc2 100644 --- a/client/src/testprogram/testprogram.cc +++ b/client/src/testprogram/testprogram.cc @@ -120,6 +120,49 @@ } + // Performance test. + static void testPerformance(const char *session) { + + try { + + TN3270::Host host{session}; + + host.connect(); + + // Check "WaitForReady" + { + time_t start = time(0); + + host.waitForReady(5); + cout << "First run:" << (time(0) - start) << endl; + + for(size_t ix=0;ix<100;ix++) { + host.waitForReady(1); + } + cout << "Time for 100 iterations: " << (time(0) - start) << endl; + + } + + // Check "Get" + { + time_t start = time(0); + + for(size_t ix=0;ix<100;ix++) { + host.toString(14,1,75,0); + } + cout << "Time for 100 iterations: " << (time(0) - start) << endl; + + } + + + } catch(const std::exception &e) { + + cerr << std::endl << e.what() << std::endl << std::endl; + + } + + } + // test host object static void testHost(const char *session) { @@ -222,8 +265,8 @@ cout << "Session: " << session << endl; - testHost(session); - + // testHost(session); + testPerformance(session); //testAttributes(session); -- libgit2 0.21.2