summaryrefslogtreecommitdiff
path: root/innobase/ha/ts/tsha.c
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2001-02-17 14:19:19 +0200
committerunknown <monty@donna.mysql.com>2001-02-17 14:19:19 +0200
commit2662b59306ef0cd495fa6e2edf7129e58a11393a (patch)
treebfe39951a73e906579ab819bf5198ad8f3a64a36 /innobase/ha/ts/tsha.c
parent66de55a56bdcf2f7a9c0c4f8e19b3e761475e202 (diff)
downloadmariadb-git-2662b59306ef0cd495fa6e2edf7129e58a11393a.tar.gz
Added Innobase to source distribution
Docs/manual.texi: Added Innobase documentation configure.in: Incremented version include/my_base.h: Added option for Innobase myisam/mi_check.c: cleanup mysql-test/t/bdb.test: cleanup mysql-test/t/innobase.test: Extended with new tests from bdb.test mysql-test/t/merge.test: Added test of SHOW create mysys/my_init.c: Fix for UNIXWARE 7 scripts/mysql_install_db.sh: Always write how to start mysqld scripts/safe_mysqld.sh: Fixed type sql/ha_innobase.cc: Update to new version sql/ha_innobase.h: Update to new version sql/handler.h: Added 'update_table_comment()' and 'append_create_info()' sql/sql_delete.cc: Fixes for Innobase sql/sql_select.cc: Fixes for Innobase sql/sql_show.cc: Append create information (for MERGE tables) sql/sql_update.cc: Fixes for Innobase
Diffstat (limited to 'innobase/ha/ts/tsha.c')
-rw-r--r--innobase/ha/ts/tsha.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/innobase/ha/ts/tsha.c b/innobase/ha/ts/tsha.c
new file mode 100644
index 00000000000..fd9a2e12f6e
--- /dev/null
+++ b/innobase/ha/ts/tsha.c
@@ -0,0 +1,120 @@
+/************************************************************************
+The test module for hash table
+
+(c) 1994, 1995 Innobase Oy
+
+Created 1/25/1994 Heikki Tuuri
+*************************************************************************/
+
+#include "ut0ut.h"
+#include "ha0ha.h"
+#include "mem0mem.h"
+#include "sync0sync.h"
+
+ulint ulint_array[200000];
+
+void
+test1(void)
+{
+ hash_table_t* table1;
+ ulint i;
+ ulint n313 = 313;
+ ulint n414 = 414;
+
+ printf("------------------------------------------------\n");
+ printf("TEST 1. BASIC TEST\n");
+
+ table1 = ha_create(50000);
+
+ ha_insert_for_fold(table1, 313, &n313);
+
+ ha_insert_for_fold(table1, 313, &n414);
+
+ ut_a(ha_validate(table1));
+
+ ha_delete(table1, 313, &n313);
+ ha_delete(table1, 313, &n414);
+
+ ut_a(ha_validate(table1));
+
+ printf("------------------------------------------------\n");
+ printf("TEST 2. TEST OF MASSIVE INSERTS AND DELETES\n");
+
+ table1 = ha_create(10000);
+
+ for (i = 0; i < 200000; i++) {
+ ulint_array[i] = i;
+ }
+
+ for (i = 0; i < 50000; i++) {
+ ha_insert_for_fold(table1, i * 7, ulint_array + i);
+ }
+
+ ut_a(ha_validate(table1));
+
+ for (i = 0; i < 50000; i++) {
+ ha_delete(table1, i * 7, ulint_array + i);
+ }
+
+ ut_a(ha_validate(table1));
+}
+
+void
+test2(void)
+{
+ hash_table_t* table1;
+ ulint i;
+ ulint oldtm, tm;
+ ha_node_t* node;
+
+ printf("------------------------------------------------\n");
+ printf("TEST 3. SPEED TEST\n");
+
+ table1 = ha_create(300000);
+
+ oldtm = ut_clock();
+
+ for (i = 0; i < 200000; i++) {
+ ha_insert_for_fold(table1, i * 27877, ulint_array + i);
+ }
+
+ tm = ut_clock();
+
+ printf("Wall clock time for %lu inserts %lu millisecs\n",
+ i, tm - oldtm);
+
+ oldtm = ut_clock();
+
+ for (i = 0; i < 200000; i++) {
+ node = ha_search(table1, i * 27877);
+ }
+
+ tm = ut_clock();
+
+ printf("Wall clock time for %lu searches %lu millisecs\n",
+ i, tm - oldtm);
+
+ oldtm = ut_clock();
+
+ for (i = 0; i < 200000; i++) {
+ ha_delete(table1, i * 27877, ulint_array + i);
+ }
+
+ tm = ut_clock();
+
+ printf("Wall clock time for %lu deletes %lu millisecs\n",
+ i, tm - oldtm);
+}
+
+void
+main(void)
+{
+ sync_init();
+ mem_init(1000000);
+
+ test1();
+
+ test2();
+
+ printf("TESTS COMPLETED SUCCESSFULLY!\n");
+}