Triton Repository branch, master, updated. 30af1a8132ee1a74c890e9a4d7d2302e3715e14d
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Triton Repository". The branch, master has been updated via 30af1a8132ee1a74c890e9a4d7d2302e3715e14d (commit) via b88b17823f9e28705edb50d0fe4720c5bdaf7535 (commit) from 2bc967ea2524a1a93cc596863cee1e156e619afe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 30af1a8132ee1a74c890e9a4d7d2302e3715e14d Author: Phil Carns <[email protected]> Date: Tue Mar 20 12:06:22 2012 -0400 starting point for idb-style tosd benchmark - incomplete right now commit b88b17823f9e28705edb50d0fe4720c5bdaf7535 Author: Phil Carns <[email protected]> Date: Tue Mar 20 12:05:00 2012 -0400 add args to init fn on aesop_main_set_with_init ----------------------------------------------------------------------- Summary of changes: code/src/aesop/resource.h | 4 +- code/src/transactional-osd/tests/module.mk.in | 1 + code/src/transactional-osd/tests/tosd-bench-idb.ae | 243 ++++++++++++++++++++ code/src/transactional-osd/tests/tosd-niid.ae | 2 +- 4 files changed, 247 insertions(+), 3 deletions(-) create mode 100644 code/src/transactional-osd/tests/tosd-bench-idb.ae Diff of changes: diff --git a/code/src/aesop/resource.h b/code/src/aesop/resource.h index 2be890c..3ea4f55 100644 --- a/code/src/aesop/resource.h +++ b/code/src/aesop/resource.h @@ -227,10 +227,10 @@ int main(int argc, char **argv) \ ae_hints_t __main_hints; \ ae_op_id_t __main_opid; \ ae_ret_t ret; \ - ae_ret_t (*__main_init_func)(void) = __init_before_main__; \ + ae_ret_t (*__main_init_func)(int argc, char** argv) = __init_before_main__; \ if(__init_before_main__) \ { \ - ret = __main_init_func(); \ + ret = __main_init_func(argc, argv); \ aesop_error_assert(ret); \ } \ ret = aesop_module_init(__init_module__); \ diff --git a/code/src/transactional-osd/tests/module.mk.in b/code/src/transactional-osd/tests/module.mk.in index 812c477..84c92ab 100644 --- a/code/src/transactional-osd/tests/module.mk.in +++ b/code/src/transactional-osd/tests/module.mk.in @@ -9,6 +9,7 @@ AETESTSRC += $(DIR)/tosd-niid.ae AETESTSRC += $(DIR)/fake1.ae AETESTSRC += $(DIR)/tosd-multi-object.ae AETESTSRC += $(DIR)/tosd-bench-concurrent.ae +AETESTSRC += $(DIR)/tosd-bench-idb.ae AETESTSRC += $(DIR)/tosd-bench-create.ae AETESTSRC += $(DIR)/workload-gen.ae AESOP_HDR += $(DIR)/fake-resource.hae diff --git a/code/src/transactional-osd/tests/tosd-bench-idb.ae b/code/src/transactional-osd/tests/tosd-bench-idb.ae new file mode 100644 index 0000000..579cdcb --- /dev/null +++ b/code/src/transactional-osd/tests/tosd-bench-idb.ae @@ -0,0 +1,243 @@ + +#include <stdio.h> +#include <errno.h> +#include <sys/time.h> +#include <stdlib.h> +#include <limits.h> +#include "src/aesop/aesop.h" +#include "src/transactional-osd/transactional-osd.hae" +#include "src/zeroconf/zeroconf.h" + +enum op_type +{ + WRITE, + READ +}; + +struct bench_op +{ + int64_t offset; + int64_t size; + enum op_type type; + struct triton_list_link list_link; +}; + +TRITON_LIST_DEFINE(op_list); +triton_mutex_t op_list_mutex = TRITON_MUTEX_INITIALIZER; + +static double Wtime(void) +{ + struct timeval t; + gettimeofday(&t, NULL); + return((double)t.tv_sec + (double)(t.tv_usec) / 1000000); +} +static double start_tm; +static double end_tm; +static int concurrent; +static uint64_t first_version; +static uint64_t version; +static int max_seconds = 0; +static uint128_t oid; + +static __blocking int do_tosd_test(void) +{ + triton_ret_t tret; + int w_flags = TOSD_FLAG_AUTO_TXN; + + tret = tosd_create(oid, 0); + if(tret == TRITON_ERR_EXIST) + { + printf("# operating on existing object.\n"); + triton_error_destroy(tret); + tret = TRITON_SUCCESS; + } + triton_error_assert(tret); + + tret = tosd_get_version(oid, &version); + triton_error_assert(tret); + + first_version = version; + + start_tm = Wtime(); + + pwait + { + pprivate int i; + pprivate struct triton_list_link* tmp_link; + pprivate char* buffer = NULL; + pprivate uint64_t b_version; + pprivate struct bench_op* tmp_op; + pprivate triton_ret_t b_ret; + pprivate int64_t out_size; + pprivate int64_t keyval_offset = 0; + pprivate int64_t* offset_ptr; + pprivate uint64_t fork; + pprivate int ret; + pprivate double now; + + for(i=0; i<concurrent; i++) + { + pbranch + { + triton_mutex_lock(&op_list_mutex); + tmp_link = triton_stack_pop(&op_list); + triton_mutex_unlock(&op_list_mutex); + + while(tmp_link) + { + b_version = version++; + + tmp_op = triton_list_get_entry(tmp_link, struct bench_op, + list_link); + + offset_ptr = &tmp_op->offset; + fork = 0; + + if(tmp_op->type == WRITE) + { + b_ret = tosd_write(oid, fork, b_version, &buffer, + &tmp_op->size, 1, &tmp_op->offset, + &tmp_op->size, 1, w_flags, 0); + triton_error_assert(b_ret); + } + else + { + assert(tmp_op->type == READ); + + b_ret = tosd_read(oid, fork, &buffer, &tmp_op->size, 1, + &tmp_op->offset, &tmp_op->size, 1, &out_size, 0); + triton_error_assert(b_ret); + assert(out_size == tmp_op->size); + } + + now = Wtime(); + triton_mutex_lock(&op_list_mutex); + /* check the time limit if applicable */ + if(max_seconds > 0 && (now - start_tm) > max_seconds) + tmp_link = NULL; + else + tmp_link = triton_stack_pop(&op_list); + triton_mutex_unlock(&op_list_mutex); + } + } + } + } + + end_tm = Wtime(); + + return 0; +} + +__blocking int aesop_main(int argc, char **argv) +{ + ae_context_t ctx; + ae_hints_t hints; + ae_op_id_t op_id; + int pc = 0; + FILE *desc = 0; + char line[2048]; + char op_string[100]; + int64_t size; + int64_t offset; + int ret; + struct bench_op* tmp_op; + triton_ret_t tret; + const char* tosd_init_flags = NULL; + int i; + + oid = triton_uint128_from_uint64(1); + + if(argc != 5) + { + fprintf(stderr, "Usage: tosd-bench-concurrent <workload description file> <dir> <concurrency> <threaded y|n>\n"); + return(-1); + } + + ret = sscanf(argv[3], "%d", &concurrent); + if(ret != 1 || concurrent < 1) + { + fprintf(stderr, "Usage: tosd-bench-concurrent <workload description file> <dir> <concurrency> <threaded y|n>\n"); + return(-1); + } + + /* parse description of workload */ + desc = fopen(argv[1], "r"); + if(!desc) + { + perror("fopen"); + return(-1); + } + while(fgets(line, 2048, desc)) + { + if(line[0] == '#') + continue; +#if SIZEOF_LONG_INT == 4 + ret = sscanf(line, "%s %lld %lld", op_string, &offset, &size); +#else + ret = sscanf(line, "%s %ld %ld", op_string, &offset, &size); +#endif + if(ret != 3) + { + fprintf(stderr, "Error: bad line: %s\n", line); + return(-1); + } + tmp_op = malloc(sizeof(*tmp_op)); + assert(tmp_op); + + if(strcmp(op_string, "write") == 0) + tmp_op->type = WRITE; + else if(strcmp(op_string, "read") == 0) + tmp_op->type = READ; + else + assert(0); + tmp_op->offset = offset; + tmp_op->size = size; + triton_list_add_back(&tmp_op->list_link, &op_list); + } + fclose(desc); + + do_tosd_test(); + + /* print command line in comments */ + printf("#"); + for(i=0; i<argc; i++) + { + printf(" %s", argv[i]); + } + printf("\n"); + printf("# <seconds> <ops/s>\n"); + printf("%f\t%f\n", end_tm-start_tm, ((double)(version-first_version))/(end_tm-start_tm)); + + return 0; +} + +static triton_ret_t init_tosd_zeroconf_params(int argc, char** argv) +{ + triton_ret_t tret; + char tosd_path_logs[PATH_MAX]; + + tret = triton_zeroconf_set("triton.tosd.db_path", argv[2]); + triton_error_assert(tret); + + sprintf(tosd_path_logs, "%s/logs", argv[2]); + tret = triton_zeroconf_set("triton.tosd.data_path", tosd_path_logs); + triton_error_assert(tret); + + tret = triton_zeroconf_set("triton.tosd.alignment", "1"); + triton_error_assert(tret); + + return(TRITON_SUCCESS); +} + +aesop_main_set_with_init(init_tosd_zeroconf_params, + "triton.tosd", + aesop_main); + +/* + * Local variables: + * c-indent-level: 4 + * c-basic-offset: 4 + * End: + * + * vim: ft=c ts=8 sts=4 sw=4 expandtab + */ diff --git a/code/src/transactional-osd/tests/tosd-niid.ae b/code/src/transactional-osd/tests/tosd-niid.ae index 45d6736..b5db64d 100644 --- a/code/src/transactional-osd/tests/tosd-niid.ae +++ b/code/src/transactional-osd/tests/tosd-niid.ae @@ -125,7 +125,7 @@ static __blocking int do_tosd_test(int argc, char **argv) return 1; } -static triton_ret_t init_tosd_zeroconf_params(void) +static triton_ret_t init_tosd_zeroconf_params(int argc, char** argv) { triton_ret_t ret; hooks/post-receive -- Triton Repository
participants (1)
-
noreply@mcs.anl.gov