Commit 26b1ca4393e0cac46cc2ccbdca0f2d0c23b2ddac

Authored by perry.werneck@gmail.com
1 parent bb4d9d9d

Incluindo teste de performance

Showing 1 changed file with 18 additions and 1 deletions   Show diff stats
src/plugins/remotectl/testprogram.c
... ... @@ -29,6 +29,7 @@
29 29  
30 30 #include <windows.h>
31 31 #include <stdio.h>
  32 + #include <time.h>
32 33 #include <pw3270/hllapi.h>
33 34  
34 35 #define BUFFER_LENGTH 8000
... ... @@ -49,8 +50,8 @@
49 50 const char * arg;
50 51 } cmd[] =
51 52 {
52   - { "ConnectPS", HLLAPI_CMD_CONNECTPS, "pw3270A" },
53 53 { "GetRevision", HLLAPI_CMD_GETREVISION, " " },
  54 + { "ConnectPS", HLLAPI_CMD_CONNECTPS, "pw3270A" },
54 55 { "InputString", HLLAPI_CMD_INPUTSTRING, "test" },
55 56  
56 57 };
... ... @@ -72,6 +73,21 @@
72 73 hllapi((LPWORD) &fn,buffer,&len,&rc);
73 74 printf("%s exits with rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",rc,buffer);
74 75  
  76 + // Performance
  77 + len = strlen(cmd[0].arg);
  78 + memcpy(buffer,cmd[0].arg,len);
  79 + if(hllapi((LPWORD) &cmd[0].fn,buffer,&len,&rc) == 0 && rc == 0)
  80 + {
  81 + time_t end = time(0) + 5;
  82 + int qtd = 0;
  83 + do
  84 + {
  85 + qtd++;
  86 + } while(hllapi((LPWORD) &cmd[0].fn,buffer,&len,&rc) == 0 && rc == 0 && time(0)<end);
  87 + printf("%d interacoes em 5 segundos (rc=%d)\n",qtd,rc);
  88 +
  89 + }
  90 +
75 91 // Disconnect
76 92 len = 10;
77 93 rc = 1;
... ... @@ -80,5 +96,6 @@
80 96 hllapi((LPWORD) &fn,buffer,&len,&rc);
81 97 printf("%s exits with rc=%d\n[%s]\n","HLLAPI_CMD_DISCONNECTPS",rc,buffer);
82 98  
  99 +
83 100 return 0;
84 101 }
... ...