Commit 1bdff3175c03ce5c9fb8b44ee28d6ec7b3db8de5

Authored by Perry Werneck
1 parent c821504d
Exists in master and in 1 other branch develop

Adding performance tests.

Showing 1 changed file with 45 additions and 2 deletions   Show diff stats
client/src/testprogram/testprogram.cc
... ... @@ -120,6 +120,49 @@
120 120  
121 121 }
122 122  
  123 + // Performance test.
  124 + static void testPerformance(const char *session) {
  125 +
  126 + try {
  127 +
  128 + TN3270::Host host{session};
  129 +
  130 + host.connect();
  131 +
  132 + // Check "WaitForReady"
  133 + {
  134 + time_t start = time(0);
  135 +
  136 + host.waitForReady(5);
  137 + cout << "First run:" << (time(0) - start) << endl;
  138 +
  139 + for(size_t ix=0;ix<100;ix++) {
  140 + host.waitForReady(1);
  141 + }
  142 + cout << "Time for 100 iterations: " << (time(0) - start) << endl;
  143 +
  144 + }
  145 +
  146 + // Check "Get"
  147 + {
  148 + time_t start = time(0);
  149 +
  150 + for(size_t ix=0;ix<100;ix++) {
  151 + host.toString(14,1,75,0);
  152 + }
  153 + cout << "Time for 100 iterations: " << (time(0) - start) << endl;
  154 +
  155 + }
  156 +
  157 +
  158 + } catch(const std::exception &e) {
  159 +
  160 + cerr << std::endl << e.what() << std::endl << std::endl;
  161 +
  162 + }
  163 +
  164 + }
  165 +
123 166 // test host object
124 167 static void testHost(const char *session) {
125 168  
... ... @@ -222,8 +265,8 @@
222 265  
223 266 cout << "Session: " << session << endl;
224 267  
225   - testHost(session);
226   -
  268 + // testHost(session);
  269 + testPerformance(session);
227 270  
228 271  
229 272 //testAttributes(session);
... ...