Commit 9cd7c3e24a2f55cb68a77b5242f6ff88706938cf
1 parent
7338ded5
Exists in
master
and in
1 other branch
Performance tests (windows).
Showing
2 changed files
with
41 additions
and
1 deletions
Show diff stats
src/core/calls.cc
src/testprogram/testprogram.cc
@@ -31,6 +31,7 @@ | @@ -31,6 +31,7 @@ | ||
31 | #include <getopt.h> | 31 | #include <getopt.h> |
32 | #include <cstring> | 32 | #include <cstring> |
33 | #include <cstdio> | 33 | #include <cstdio> |
34 | + #include <ctime> | ||
34 | #include <lib3270/hllapi.h> | 35 | #include <lib3270/hllapi.h> |
35 | 36 | ||
36 | #define SCREEN_LENGTH 2000 | 37 | #define SCREEN_LENGTH 2000 |
@@ -201,6 +202,45 @@ | @@ -201,6 +202,45 @@ | ||
201 | cout << "Searching for \"" << (cmdline.c_str()+5) << "\"" << endl; | 202 | cout << "Searching for \"" << (cmdline.c_str()+5) << "\"" << endl; |
202 | rc = hllapi_find_text((LPSTR) (cmdline.c_str()+5)); | 203 | rc = hllapi_find_text((LPSTR) (cmdline.c_str()+5)); |
203 | 204 | ||
205 | + } else if(strcasecmp(cmdline.c_str(),"perftest") == 0) { | ||
206 | + | ||
207 | + if(!hllapi_is_connected()) { | ||
208 | + | ||
209 | + cout << "Connect to host first" << endl; | ||
210 | + | ||
211 | + } else { | ||
212 | + | ||
213 | + // Test "hllapi_wait_for_ready | ||
214 | + cout << "Testing hllapi_wait_for_ready" << endl; | ||
215 | + { | ||
216 | + time_t start_time = time(0); | ||
217 | + for(size_t ix = 0; ix < 100; ix++) { | ||
218 | + | ||
219 | + hllapi_wait_for_ready(10); | ||
220 | + | ||
221 | + } | ||
222 | + cout << "Time for 100 iterations of hllapi_wait_for_ready was " << (time(0) - start_time) << " seconds" << endl; | ||
223 | + | ||
224 | + } | ||
225 | + | ||
226 | + // Teste hllapi_get_string_at | ||
227 | + { | ||
228 | + cout << "Testing hllapi_get_screen_at" << endl; | ||
229 | + char buffer[81]; | ||
230 | + time_t start_time = time(0); | ||
231 | + for(size_t ix = 0; ix < 100; ix++) { | ||
232 | + | ||
233 | + memset(buffer,' ',sizeof(buffer)); | ||
234 | + buffer[80] = 0; | ||
235 | + hllapi_get_screen_at(14,1,buffer); | ||
236 | + | ||
237 | + } | ||
238 | + cout << "Time for 100 iterations of hllapi_get_screen_at was " << (time(0) - start_time) << " seconds" << endl; | ||
239 | + | ||
240 | + } | ||
241 | + | ||
242 | + } | ||
243 | + | ||
204 | } else { | 244 | } else { |
205 | 245 | ||
206 | cout << "Unknown command \"" << cmdline << "\""<< endl; | 246 | cout << "Unknown command \"" << cmdline << "\""<< endl; |