lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <ba90a4f9a402044c110a087155e7c077ef469f35.camel@mailbox.org>
Date:   Tue, 02 May 2023 00:23:11 -0400
From:   liuwf <liuwf@...lbox.org>
To:     linux-kernel@...r.kernel.org
Subject: Library: [RFC PATCH 3/3] btree_blue - A simple btree with fast
 linear traverse

Library: [RFC PATCH 3/3] btree_blue - A simple btree with fast linear traverse

From: Liu Weifeng 4019c26b5c0d5f6b <liuwf@...lbox.org>

This is test prog file

Signed-off-by: Liu Weifeng 4019c26b5c0d5f6b <liuwf@...lbox.org>
---
 lib/btree_blue_test.c | 70 ++++++++++++++++++++++++-------------------
 1 file changed, 40 insertions(+), 30 deletions(-)

diff --git a/lib/btree_blue_test.c b/lib/btree_blue_test.c
index b0a73836523d..715dc614e7dd 100644
--- a/lib/btree_blue_test.c
+++ b/lib/btree_blue_test.c
@@ -128,7 +128,8 @@ static int btree_blue_test_init(void)
 		goto exit;
 	}
 
-	printk(KERN_EMERG "%lu inserts to a empty tree ...\n", RANDOM_NR);
+	printk(KERN_EMERG "insert %lu random keys to a empty tree ...\n",
+	       RANDOM_NR);
 	err = 0;
 
 	t0 = ktime_get_ns();
@@ -142,7 +143,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "maple tree %lu inserts use time: %lu ns\n",
+	printk(KERN_EMERG
+	       "maple tree inserts %lu random keys use time: %lu ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -159,8 +161,8 @@ static int btree_blue_test_init(void)
 		rb_add(&entry_ptr->node, &rbtree_root, rbtree_entry_less);
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "rbtree %lu inserts use time: %ld ns\n", RANDOM_NR,
-	       t0);
+	printk(KERN_EMERG "rbtree inserts %lu random keys use time: %ld ns\n",
+	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
 	for (long i = 0; i < RANDOM_NR; i++) {
@@ -187,10 +189,13 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree_blue %lu inserts use time: %ld ns\n",
+	printk(KERN_EMERG
+	       "btree_blue inserts %lu random keys use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
-	printk(KERN_EMERG "%lu searches ...\n", RANDOM_NR);
+	printk(KERN_EMERG
+	       "search %lu random keys in  a tree which has those keys ...\n",
+	       RANDOM_NR);
 	err = 0;
 
 	t0 = ktime_get_ns();
@@ -205,7 +210,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "maple tree %lu searches use time: %lu ns\n",
+	printk(KERN_EMERG
+	       "maple tree search %lu random keys use time: %lu ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -219,8 +225,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "rbtree %lu searches use time: %ld ns\n", RANDOM_NR,
-	       t0);
+	printk(KERN_EMERG "rbtree search %lu random keys use time: %ld ns\n",
+	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
 	for (long i = 0; i < RANDOM_NR; i++) {
@@ -233,8 +239,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree %lu searches use time: %ld ns\n", RANDOM_NR,
-	       t0);
+	printk(KERN_EMERG "btree search %lu random keys use time: %ld ns\n",
+	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
 	for (long i = 0; i < RANDOM_NR; i++) {
@@ -249,11 +255,12 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree_blue %lu searches use time: %ld ns\n",
+	printk(KERN_EMERG
+	       "btree_blue search %lu random keys use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
 	printk(KERN_EMERG
-	       "%lu mixed insert + delete based on a tree which has %lu keys ...\n",
+	       "%lu random mixed insert + delete based on a tree which has %lu keys ...\n",
 	       RANDOM_NR, RANDOM_NR);
 	err = 0;
 
@@ -277,7 +284,7 @@ static int btree_blue_test_init(void)
 	}
 	t0 = ktime_get_ns() - t0;
 	printk(KERN_EMERG
-	       "maple tree %lu mixed insert + delete use time: %ld ns\n",
+	       "maple tree %lu random mixed insert + delete use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -306,7 +313,8 @@ static int btree_blue_test_init(void)
 		kmem_cache_free(rbtree_node_cache, entry_ptr);
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "rbtree %lu mixed insert + delete use time: %ld ns\n",
+	printk(KERN_EMERG
+	       "rbtree %lu random mixed insert + delete use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -329,7 +337,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree %lu mixed insert + delete use time: %ld ns\n",
+	printk(KERN_EMERG
+	       "btree %lu random mixed insert + delete use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -354,11 +363,10 @@ static int btree_blue_test_init(void)
 	}
 	t0 = ktime_get_ns() - t0;
 	printk(KERN_EMERG
-	       "btree_blue %lu mixed insert + delete use time: %ld ns\n",
+	       "btree_blue %lu random mixed insert + delete use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
-	printk(KERN_EMERG
-	       "get prev key in a tree which has %lu keys to empty ...\n",
+	printk(KERN_EMERG "get prev key in a tree which has %lu keys ...\n",
 	       RANDOM_NR);
 	err = 0;
 
@@ -427,7 +435,7 @@ static int btree_blue_test_init(void)
 					     btree_blue_visit, GET_PREV);
 	t0 = ktime_get_ns() - t0;
 	printk(KERN_EMERG
-	       "btree_blue get %lu prev keys in traversal way use time %ld ns\n",
+	       "btree_blue get %lu prev keys in callback way use time %ld ns\n",
 	       total, t0);
 
 	printk(KERN_EMERG
@@ -473,11 +481,11 @@ static int btree_blue_test_init(void)
 			return -1;
 		}
 	}
-	printk(KERN_EMERG
-	       "btree_blue %lu traversed values are verified successfully\n",
+	printk(KERN_EMERG "btree_blue %lu traversed values are verified OK\n",
 	       RANDOM_NR);
 
-	printk(KERN_EMERG "delete a tree which has %lu keys to empty ...\n",
+	printk(KERN_EMERG
+	       "random delete a tree which has %lu keys to empty ...\n",
 	       RANDOM_NR);
 	err = 0;
 
@@ -492,7 +500,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "maple tree %lu deletes use time: %ld ns\n",
+	printk(KERN_EMERG
+	       "maple tree random deletes %lu keys use time: %ld ns\n",
 	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
@@ -510,8 +519,8 @@ static int btree_blue_test_init(void)
 		kmem_cache_free(rbtree_node_cache, entry_ptr);
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "rbtree %lu deletes use time: %ld ns\n", RANDOM_NR,
-	       t0);
+	printk(KERN_EMERG "rbtree random deletes %lu keys use time: %ld ns\n",
+	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
 	for (long i = 0; i < RANDOM_NR; i++) {
@@ -525,8 +534,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree %lu deletes use time: %lu ns\n", RANDOM_NR,
-	       t0);
+	printk(KERN_EMERG "btree random deletes %lu keys use time: %lu ns\n",
+	       RANDOM_NR, t0);
 
 	t0 = ktime_get_ns();
 	for (long i = 0; i < RANDOM_NR; i++) {
@@ -541,7 +550,8 @@ static int btree_blue_test_init(void)
 		}
 	}
 	t0 = ktime_get_ns() - t0;
-	printk(KERN_EMERG "btree_blue %lu deletes use time: %lu ns\n",
+	printk(KERN_EMERG
+	       "btree_blue random deletes %lu keys use time: %lu ns\n",
 	       RANDOM_NR, t0);
 
 exit:
@@ -555,7 +565,7 @@ static int btree_blue_test_init(void)
 	btree_blue_destroy(&btree_blue_root);
 
 	if (!err) {
-		printk(KERN_EMERG "Test successfully finished.\n");
+		printk(KERN_EMERG "Test finished successfully.\n");
 		return 0;
 	} else
 		return -1;
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ