diff options
Diffstat (limited to 'innobase/srv/ts')
-rw-r--r-- | innobase/srv/ts/makefile | 15 | ||||
-rw-r--r-- | innobase/srv/ts/tsdbc.c | 118 | ||||
-rw-r--r-- | innobase/srv/ts/tssrv.c | 39 |
3 files changed, 172 insertions, 0 deletions
diff --git a/innobase/srv/ts/makefile b/innobase/srv/ts/makefile new file mode 100644 index 00000000000..0b743e37a20 --- /dev/null +++ b/innobase/srv/ts/makefile @@ -0,0 +1,15 @@ + + + +include ..\..\makefile.i + +tssrv: ..\srv.lib tssrv.c makefile + $(CCOM) $(CFL) -I.. -I..\.. ..\srv.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\btr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tssrv.c $(LFL) + + + + + + + + diff --git a/innobase/srv/ts/tsdbc.c b/innobase/srv/ts/tsdbc.c new file mode 100644 index 00000000000..83ba081959d --- /dev/null +++ b/innobase/srv/ts/tsdbc.c @@ -0,0 +1,118 @@ +/************************************************************************ +Database client test program + +(c) 1995 Innobase Oy + +Created 10/10/1995 Heikki Tuuri +*************************************************************************/ + +#include "com0com.h" +#include "com0shm.h" +#include "ut0ut.h" +#include "mem0mem.h" +#include "os0thread.h" +#include "sync0ipm.h" +#include "sync0sync.h" + +byte buf[10000]; +char addr[150]; + +void +test1(void) +/*=======*/ +{ + com_endpoint_t* ep; + ulint ret; + ulint size; + ulint len; + ulint addr_len; + ulint i, j; + ulint tm, oldtm; + + + oldtm = ut_clock(); + + for (i = 0; i < 10000; i++) { + + ut_delay(100); + } + + for (j = 0; j < i / 10; j++) { + + ut_delay(200); + } + + tm = ut_clock(); + printf("Wall clock time for test without server %ld milliseconds\n", + tm - oldtm); + printf("%lu rounds\n", i); + + ep = com_endpoint_create(COM_SHM); + + ut_a(ep); + + size = 8192; + + ret = com_endpoint_set_option(ep, COM_OPT_MAX_DGRAM_SIZE, + (byte*)&size, 0); + + ut_a(ret == 0); + + ret = com_bind(ep, "CLI", 3); + + ut_a(ret == 0); + + printf("Client endpoint created!\n"); + + oldtm = ut_clock(); + + for (i = 0; i < 50000; i++) { + + ret = com_sendto(ep, (byte*)"Hello from client!\n", 18, "ibsrv", 5); + + ut_a(ret == 0); + + ret = com_recvfrom(ep, buf, 10000, &len, addr, 150, &addr_len); + + ut_a(ret == 0); + + buf[len] = '\0'; + addr[addr_len] = '\0'; +/* + printf( + "Message of len %lu\n%s \nreceived from address %s of len %lu\n", + len, buf, addr, addr_len); +*/ + } + + + tm = ut_clock(); + printf("Wall clock time for test %ld milliseconds\n", tm - oldtm); + printf("%lu message pairs\n", i); + + + printf("System calls in com_shm %lu ip_mutex %lu mutex %lu\n", + com_shm_system_call_count, + ip_mutex_system_call_count, + mutex_system_call_count); + + + ret = com_endpoint_free(ep); + + ut_ad(ret == 0); +} + +void +main(void) +/*======*/ +{ + + + + sync_init(); + mem_init(); + + test1(); + + printf("TESTS COMPLETED SUCCESSFULLY!\n"); +} diff --git a/innobase/srv/ts/tssrv.c b/innobase/srv/ts/tssrv.c new file mode 100644 index 00000000000..92b98c4554e --- /dev/null +++ b/innobase/srv/ts/tssrv.c @@ -0,0 +1,39 @@ +/****************************************************** +Test for the database server + +(c) 1995 Innobase Oy + +Created 10/10/1995 Heikki Tuuri +*******************************************************/ + +#include "srv0srv.h" +#include "os0proc.h" +#include "ut0mem.h" + + +/*************************************************************************** +The main function of the server. */ + +void +main( +/*=*/ +#ifdef notdefined + + ulint argc, /* in: number of string arguments given on + the command line */ + char* argv[] +#endif +) /* in: array of character pointers giving + the arguments */ +{ +/* + if (argc != 2) { + printf("Error! Wrong number of command line arguments!\n"); + printf("Usage: ib <init-file-name>\n"); + os_process_exit(1); + } +*/ + srv_boot("init.ib"/*argv[1]*/); + + os_process_exit(0); +} |