diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-21 07:23:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:17 -0500 |
commit | 650d81b252cc669ef848448afad7e9bb79c4f20e (patch) | |
tree | 7108ada18c4d7fff581470791832850c17eab6bf /source4/cluster/ctdb/tests/ctdb_bench.c | |
parent | 66a9f1e2764900a2c22a4bfad9f9caf3db729385 (diff) | |
download | samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.gz samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.bz2 samba-650d81b252cc669ef848448afad7e9bb79c4f20e.zip |
r22421: merged in latest ctdb changes from bzr
(This used to be commit 3633f862b966866819c9a0a6ad0238a858e15e62)
Diffstat (limited to 'source4/cluster/ctdb/tests/ctdb_bench.c')
-rw-r--r-- | source4/cluster/ctdb/tests/ctdb_bench.c | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/source4/cluster/ctdb/tests/ctdb_bench.c b/source4/cluster/ctdb/tests/ctdb_bench.c index 37c095c0c0..02fcc1f2d4 100644 --- a/source4/cluster/ctdb/tests/ctdb_bench.c +++ b/source4/cluster/ctdb/tests/ctdb_bench.c @@ -22,7 +22,7 @@ #include "lib/events/events.h" #include "system/filesys.h" #include "popt.h" -#include "tests/cmdline.h" +#include "cmdline.h" #include <sys/time.h> #include <time.h> @@ -45,7 +45,6 @@ static double end_timer(void) static int timelimit = 10; static int num_records = 10; static int num_msgs = 1; -static int num_repeats = 100; enum my_functions {FUNC_INCR=1, FUNC_FETCH=2}; @@ -78,51 +77,6 @@ static int fetch_func(struct ctdb_call_info *call) return 0; } -/* - benchmark incrementing an integer -*/ -static void bench_incr(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db) -{ - int loops=0; - int ret, i; - struct ctdb_call call; - - ZERO_STRUCT(call); - - start_timer(); - - while (1) { - uint32_t v = loops % num_records; - - call.call_id = FUNC_INCR; - call.key.dptr = (uint8_t *)&v; - call.key.dsize = 4; - - for (i=0;i<num_repeats;i++) { - ret = ctdb_call(ctdb_db, &call); - if (ret != 0) { - printf("incr call failed - %s\n", ctdb_errstr(ctdb)); - return; - } - } - if (num_repeats * (++loops) % 10000 == 0) { - if (end_timer() > timelimit) break; - printf("Incr: %.2f ops/sec\r", num_repeats*loops/end_timer()); - fflush(stdout); - } - } - - call.call_id = FUNC_FETCH; - - ret = ctdb_call(ctdb_db, &call); - if (ret == -1) { - printf("ctdb_call FUNC_FETCH failed - %s\n", ctdb_errstr(ctdb)); - return; - } - - printf("Incr: %.2f ops/sec (loops=%d val=%d)\n", - num_repeats*loops/end_timer(), loops, *(uint32_t *)call.reply_data.dptr); -} static int msg_count; static int msg_plus, msg_minus; @@ -259,6 +213,7 @@ int main(int argc, const char *argv[]) bench_ring(ctdb, ev); /* shut it down */ - talloc_free(ctdb); + ctdb_shutdown(ctdb); + return 0; } |