Merge lp:~mdcallag/sysbench trunk to get revisions:
69 : make --with-lua=no disable lua support 70 : add --rand-seed to set RNG seed
This commit is contained in:
@ -8,11 +8,12 @@ AC_ARG_WITH(lua,
|
||||
[ac_cv_use_lua="$with_lua"], [ac_cv_use_lua="yes"])
|
||||
AC_CACHE_CHECK([whether to compile with Lua support], [ac_cv_use_lua], [ac_cv_use_lua=no])
|
||||
|
||||
if test "xac_cv_use_lua" != "xno"; then
|
||||
if test "x$ac_cv_use_lua" != "xno"; then
|
||||
|
||||
AC_DEFINE(HAVE_LUA, 1, [Define to 1 if you have Lua headers and libraries])
|
||||
AM_CONDITIONAL(USE_LUA, test "x$ac_cv_use_lua" != "x")
|
||||
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_LUA, test "x$ac_cv_use_lua" != "xno")
|
||||
])
|
||||
|
||||
|
||||
@ -83,6 +83,7 @@ static int (*rand_func)(int, int); /* pointer to random numbers generator */
|
||||
static unsigned int rand_iter;
|
||||
static unsigned int rand_pct;
|
||||
static unsigned int rand_res;
|
||||
static int rand_seed; /* optional seed set on the command line */
|
||||
|
||||
/* Random seed used to generate unique random numbers */
|
||||
static unsigned long long rnd_seed;
|
||||
@ -113,6 +114,7 @@ sb_arg_t general_args[] =
|
||||
SB_ARG_TYPE_INT, "1"},
|
||||
{"rand-spec-res", "percentage of 'special' values to use (for special distribution)",
|
||||
SB_ARG_TYPE_INT, "75"},
|
||||
{"rand-seed", "seed for random number generator, ignored when 0", SB_ARG_TYPE_INT, "0"},
|
||||
{NULL, NULL, SB_ARG_TYPE_NULL, NULL}
|
||||
};
|
||||
|
||||
@ -341,6 +343,16 @@ void print_run_mode(sb_test_t *test)
|
||||
sb_srnd(time(NULL));
|
||||
}
|
||||
|
||||
if (rand_seed)
|
||||
{
|
||||
log_text(LOG_NOTICE, "Initializing random number generator from seed (%d).\n", rand_seed);
|
||||
sb_srnd(rand_seed);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_text(LOG_NOTICE, "Random number generator seed is 0 and will be ignored\n");
|
||||
}
|
||||
|
||||
if (sb_globals.force_shutdown)
|
||||
log_text(LOG_NOTICE, "Forcing shutdown in %u seconds",
|
||||
sb_globals.max_time + sb_globals.timeout);
|
||||
@ -607,6 +619,13 @@ static int init(void)
|
||||
sb_globals.validate = sb_get_value_flag("validate");
|
||||
|
||||
rand_init = sb_get_value_flag("rand-init");
|
||||
rand_seed = sb_get_value_flag("rand-seed");
|
||||
if (rand_init && rand_seed)
|
||||
{
|
||||
log_text(LOG_FATAL, "Cannot set both --rand-init and --rand-seed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = sb_get_value_string("rand-type");
|
||||
if (!strcmp(s, "uniform"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user