--- libaitrpc/example/tcli.c 2012/05/16 16:36:10 1.7.4.3 +++ libaitrpc/example/tcli.c 2012/05/17 21:40:02 1.7.4.14 @@ -11,6 +11,7 @@ int main() ait_val_t tval, *v = NULL; array_t *valz, *arr; char *mem, *blob43 = malloc(512); + struct timeval after, before; cli = rpc_cli_openClient(100, 2, 1024 * 10, "127.0.0.1", 11111); if (!cli) { @@ -25,6 +26,36 @@ int main() rpc_cli_closeClient(&cli); free(blob43); return 1; + } + + printf("\n\n>>> RPC ping without reply!!!\n\n"); + for (i = 0; i < 10000; i++) { + gettimeofday(&before, NULL); + if (rpc_cli_execCall(cli, RPC_NOREPLY, CALL_SRVPING, NULL, &arr)) { + printf("error:: errno=%d %s\n", rpc_GetErrno(), rpc_GetError()); + rpc_cli_closeBLOBClient(&cli2); + rpc_cli_closeClient(&cli); + free(blob43); + return 127; + } + gettimeofday(&after, NULL); + io_freeVars(&arr); + printf("RPC ping #%d --- %f\n", i, (after.tv_sec - before.tv_sec) + + (after.tv_usec - before.tv_usec) / 1.e6); + } + printf("\n\n>>> RPC ping\n\n"); + for (i = 0; i < 10000; i++) { + gettimeofday(&before, NULL); + if ((ret = rpc_cli_ping(cli)) == -1) { + printf("error:: errno=%d %s\n", rpc_GetErrno(), rpc_GetError()); + rpc_cli_closeBLOBClient(&cli2); + rpc_cli_closeClient(&cli); + free(blob43); + return 127; + } + gettimeofday(&after, NULL); + printf("RPC ping seq[0x%04x] #%d --- %f\n", ret, i, + (after.tv_sec - before.tv_sec) + (after.tv_usec - before.tv_usec) / 1.e6); } memset(blob43, 0, 512);