Merge lp:~mdcallag/sysbench/trunk into lp:~sysbench-developers/sysbench/trunk

Proposed by Mark Callaghan
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the revision history of the source branch.
Merged at revision: not available
Proposed branch: lp:~mdcallag/sysbench/trunk
Merge into: lp:~sysbench-developers/sysbench/trunk
Diff against target: 69 lines
2 files modified
m4/ac_lua_devel.m4 (+3/-2)
sysbench/sysbench.c (+19/-0)
To merge this branch: bzr merge lp:~mdcallag/sysbench/trunk
Reviewer Review Type Date Requested Status
Alexey Kopytov Approve
Review via email: mp+12675@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Mark Callaghan (mdcallag) wrote :

There are two commits. The first makes --with-lua disable support for Lua. The second adds the --rand-seed command line option.

I am new to using bzr for this. Let me know if I am doing this wrong.

Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve
lp:~mdcallag/sysbench/trunk updated
69. By Mark Callaghan

Merge lp:~mdcallag/sysbench trunk to get revisions:
69 : make --with-lua=no disable lua support
70 : add --rand-seed to set RNG seed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'm4/ac_lua_devel.m4'
2--- m4/ac_lua_devel.m4 2009-09-21 19:25:59 +0000
3+++ m4/ac_lua_devel.m4 2009-09-30 18:10:21 +0000
4@@ -8,11 +8,12 @@
5 [ac_cv_use_lua="$with_lua"], [ac_cv_use_lua="yes"])
6 AC_CACHE_CHECK([whether to compile with Lua support], [ac_cv_use_lua], [ac_cv_use_lua=no])
7
8-if test "xac_cv_use_lua" != "xno"; then
9+if test "x$ac_cv_use_lua" != "xno"; then
10
11 AC_DEFINE(HAVE_LUA, 1, [Define to 1 if you have Lua headers and libraries])
12-AM_CONDITIONAL(USE_LUA, test "x$ac_cv_use_lua" != "x")
13
14 fi
15+
16+AM_CONDITIONAL(USE_LUA, test "x$ac_cv_use_lua" != "xno")
17 ])
18
19
20=== modified file 'sysbench/sysbench.c'
21--- sysbench/sysbench.c 2009-06-10 23:43:32 +0000
22+++ sysbench/sysbench.c 2009-09-30 18:10:21 +0000
23@@ -83,6 +83,7 @@
24 static unsigned int rand_iter;
25 static unsigned int rand_pct;
26 static unsigned int rand_res;
27+static int rand_seed; /* optional seed set on the command line */
28
29 /* Random seed used to generate unique random numbers */
30 static unsigned long long rnd_seed;
31@@ -113,6 +114,7 @@
32 SB_ARG_TYPE_INT, "1"},
33 {"rand-spec-res", "percentage of 'special' values to use (for special distribution)",
34 SB_ARG_TYPE_INT, "75"},
35+ {"rand-seed", "seed for random number generator, ignored when 0", SB_ARG_TYPE_INT, "0"},
36 {NULL, NULL, SB_ARG_TYPE_NULL, NULL}
37 };
38
39@@ -341,6 +343,16 @@
40 sb_srnd(time(NULL));
41 }
42
43+ if (rand_seed)
44+ {
45+ log_text(LOG_NOTICE, "Initializing random number generator from seed (%d).\n", rand_seed);
46+ sb_srnd(rand_seed);
47+ }
48+ else
49+ {
50+ log_text(LOG_NOTICE, "Random number generator seed is 0 and will be ignored\n");
51+ }
52+
53 if (sb_globals.force_shutdown)
54 log_text(LOG_NOTICE, "Forcing shutdown in %u seconds",
55 sb_globals.max_time + sb_globals.timeout);
56@@ -607,6 +619,13 @@
57 sb_globals.validate = sb_get_value_flag("validate");
58
59 rand_init = sb_get_value_flag("rand-init");
60+ rand_seed = sb_get_value_flag("rand-seed");
61+ if (rand_init && rand_seed)
62+ {
63+ log_text(LOG_FATAL, "Cannot set both --rand-init and --rand-seed");
64+ return 1;
65+ }
66+
67 s = sb_get_value_string("rand-type");
68 if (!strcmp(s, "uniform"))
69 {

Subscribers

People subscribed via source and target branches