Commit 6e99538812e3f7a286a8b33fa504db47b313f793
Exists in
master
and in
1 other branch
Merge branch 'develop' of https://github.com/PerryWerneck/libipc3270 into develop
Showing
1 changed file
with
45 additions
and
2 deletions
Show diff stats
client/src/testprogram/testprogram.cc
@@ -120,6 +120,49 @@ | @@ -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 | // test host object | 166 | // test host object |
124 | static void testHost(const char *session) { | 167 | static void testHost(const char *session) { |
125 | 168 | ||
@@ -232,8 +275,8 @@ | @@ -232,8 +275,8 @@ | ||
232 | 275 | ||
233 | cout << "Session: " << session << endl; | 276 | cout << "Session: " << session << endl; |
234 | 277 | ||
235 | - testHost(session); | ||
236 | - | 278 | + // testHost(session); |
279 | + testPerformance(session); | ||
237 | 280 | ||
238 | 281 | ||
239 | //testAttributes(session); | 282 | //testAttributes(session); |