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,6 +29,7 @@
29 29
30 #include <windows.h> 30 #include <windows.h>
31 #include <stdio.h> 31 #include <stdio.h>
  32 + #include <time.h>
32 #include <pw3270/hllapi.h> 33 #include <pw3270/hllapi.h>
33 34
34 #define BUFFER_LENGTH 8000 35 #define BUFFER_LENGTH 8000
@@ -49,8 +50,8 @@ @@ -49,8 +50,8 @@
49 const char * arg; 50 const char * arg;
50 } cmd[] = 51 } cmd[] =
51 { 52 {
52 - { "ConnectPS", HLLAPI_CMD_CONNECTPS, "pw3270A" },  
53 { "GetRevision", HLLAPI_CMD_GETREVISION, " " }, 53 { "GetRevision", HLLAPI_CMD_GETREVISION, " " },
  54 + { "ConnectPS", HLLAPI_CMD_CONNECTPS, "pw3270A" },
54 { "InputString", HLLAPI_CMD_INPUTSTRING, "test" }, 55 { "InputString", HLLAPI_CMD_INPUTSTRING, "test" },
55 56
56 }; 57 };
@@ -72,6 +73,21 @@ @@ -72,6 +73,21 @@
72 hllapi((LPWORD) &fn,buffer,&len,&rc); 73 hllapi((LPWORD) &fn,buffer,&len,&rc);
73 printf("%s exits with rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",rc,buffer); 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 // Disconnect 91 // Disconnect
76 len = 10; 92 len = 10;
77 rc = 1; 93 rc = 1;
@@ -80,5 +96,6 @@ @@ -80,5 +96,6 @@
80 hllapi((LPWORD) &fn,buffer,&len,&rc); 96 hllapi((LPWORD) &fn,buffer,&len,&rc);
81 printf("%s exits with rc=%d\n[%s]\n","HLLAPI_CMD_DISCONNECTPS",rc,buffer); 97 printf("%s exits with rc=%d\n[%s]\n","HLLAPI_CMD_DISCONNECTPS",rc,buffer);
82 98
  99 +
83 return 0; 100 return 0;
84 } 101 }