summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcfp <linux@jcf.pm>2017-07-06 23:31:30 +0200
committerjcfp <linux@jcf.pm>2017-07-06 23:31:30 +0200
commit016f8f9515d8f902f27a2330c3cb0273c522c2fe (patch)
tree792923afe306e0f71be248046c6d76a987c9df54
parenteef96d1b78d1541e3b2fe54340179f71a1b199ee (diff)
New upstream version 1.0.8+ds
-rw-r--r--ChangeLog13
-rw-r--r--configure.ac2
-rw-r--r--src/lua/internal/sysbench.lua2
-rw-r--r--src/sb_lua.c8
-rw-r--r--src/sb_rand.c2
-rw-r--r--src/sysbench.c47
-rw-r--r--src/tests/cpu/sb_cpu.c16
-rw-r--r--src/tests/fileio/sb_fileio.c1
-rw-r--r--tests/t/api_reports.t16
-rw-r--r--tests/t/opt_help.t2
-rw-r--r--tests/t/test_cpu.t2
-rw-r--r--tests/t/test_fileio.t5
12 files changed, 60 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index d61c5e1..2f41d8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-07-04 Alexey Kopytov <akopytov@gmail.com>
+
+ * version 1.0.8
+ * fixed api_report test for slow machines (thanks to @jcfp)
+ * fileio: suggest to run prepare step on missing files (thanks
+ to Heinrich Schuchardt)
+ * JSON reports: removed an erroneous trailing comma (GH-139)
+ * added events per second to the CPU benchmark report (GH-140)
+ * fixed db_connect() in legacy SQL API to use the default value
+ for --db-driver (GH-146)
+ * removed busy-wait in the bounded event generation mode
+ (--rate) to avoid CPU hogging
+
2017-05-15 Alexey Kopytov <akopytov@gmail.com>
* version 1.0.7
diff --git a/configure.ac b/configure.ac
index fd6cbe6..5eabff1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.63)
-AC_INIT([sysbench],[1.0.7],[https://github.com/akopytov/sysbench/issues],
+AC_INIT([sysbench],[1.0.8],[https://github.com/akopytov/sysbench/issues],
[sysbench], [https://github.com/akopytov/sysbench])
AC_CONFIG_AUX_DIR([config])
# Setting CFLAGS here prevents AC_CANONICAL_TARGET from injecting them
diff --git a/src/lua/internal/sysbench.lua b/src/lua/internal/sysbench.lua
index 48cf3bb..5b5074b 100644
--- a/src/lua/internal/sysbench.lua
+++ b/src/lua/internal/sysbench.lua
@@ -100,7 +100,7 @@ function sysbench.report_json(stat)
"total": %4.2f,
"reads": %4.2f,
"writes": %4.2f,
- "other": %4.2f,
+ "other": %4.2f
},
"latency": %4.2f,
"errors": %4.2f,
diff --git a/src/sb_lua.c b/src/sb_lua.c
index 7898089..f174883 100644
--- a/src/sb_lua.c
+++ b/src/sb_lua.c
@@ -880,12 +880,14 @@ int sb_lua_db_connect(lua_State *L)
sb_lua_ctxt_t * const ctxt = &tls_lua_ctxt;
ctxt->driver = db_create(NULL);
- if (ctxt->driver == NULL) {
+ if (ctxt->driver == NULL)
+ {
luaL_error(L, "DB initialization failed");
- lua_pushstring(L, ctxt->driver->sname);
- lua_setglobal(L, "db_driver");
}
+ lua_pushstring(L, ctxt->driver->sname);
+ lua_setglobal(L, "db_driver");
+
if (ctxt->con != NULL)
return 0;
diff --git a/src/sb_rand.c b/src/sb_rand.c
index 70bc4ae..e0561f9 100644
--- a/src/sb_rand.c
+++ b/src/sb_rand.c
@@ -60,7 +60,7 @@ static sb_arg_t rand_args[] =
SB_OPT("rand-seed",
"seed for random number generator. When 0, the current time is "
"used as a RNG seed.", "0", INT),
- SB_OPT("rand-pareto-h", "parameter h for pareto distibution", "0.2", DOUBLE),
+ SB_OPT("rand-pareto-h", "parameter h for pareto distribution", "0.2", DOUBLE),
SB_OPT_END
};
diff --git a/src/sysbench.c b/src/sysbench.c
index ab5549d..ec65d51 100644
--- a/src/sysbench.c
+++ b/src/sysbench.c
@@ -186,6 +186,10 @@ void sb_report_intermediate(sb_stat_t *stat)
stat->events / stat->time_interval,
sb_globals.percentile,
SEC2MS(stat->latency_pct));
+ if (sb_globals.tx_rate > 0)
+ log_timestamp(LOG_NOTICE, stat->time_total,
+ "queue length: %" PRIu64 " concurrency: %" PRIu64,
+ stat->queue_length, stat->concurrency);
}
@@ -703,7 +707,7 @@ bool sb_more_events(int thread_id)
while (!ck_ring_dequeue_spmc(&queue_ring, queue_ring_buffer, &ptr) &&
!ck_pr_load_int(&queue_is_full))
- ck_pr_stall();
+ usleep(500000.0 * sb_globals.threads / sb_globals.tx_rate);
if (ck_pr_load_int(&queue_is_full))
{
@@ -721,45 +725,6 @@ bool sb_more_events(int thread_id)
return true;
}
-/*
- Get the next event, or return an 'empty' event with type = SB_REQ_TYPE_NULL,
- if there are no more events to execute.
-*/
-
-sb_event_t sb_next_event(sb_test_t *test, int thread_id)
-{
- uint64_t queue_start_time = 0;
-
- /* If we are in tx_rate mode, we take events from queue */
- if (sb_globals.tx_rate > 0)
- {
- void *ptr = NULL;
-
- while (!ck_ring_dequeue_spmc(&queue_ring, queue_ring_buffer, &ptr) &&
- !ck_pr_load_int(&queue_is_full))
- ck_pr_stall();
-
- if (ck_pr_load_int(&queue_is_full))
- {
- log_text(LOG_FATAL, "Event queue is full. Terminating the worker thread");
-
- sb_event_t event;
- event.type = SB_REQ_TYPE_NULL;
-
- return event;
- }
-
- queue_start_time = ((uint64_t *) ptr)[0];
-
- ck_pr_inc_int(&sb_globals.concurrency);
-
- timers[thread_id].queue_time = sb_timer_value(&sb_exec_timer) -
- queue_start_time;
- }
-
- return test->ops.next_event(thread_id);
-}
-
void sb_event_start(int thread_id)
{
@@ -796,7 +761,7 @@ static int thread_run(sb_test_t *test, int thread_id)
while (sb_more_events(thread_id) && rc == 0)
{
- event = sb_next_event(test, thread_id);
+ event = test->ops.next_event(thread_id);
if (event.type == SB_REQ_TYPE_NULL)
break;
diff --git a/src/tests/cpu/sb_cpu.c b/src/tests/cpu/sb_cpu.c
index f3dfed6..46a9cf9 100644
--- a/src/tests/cpu/sb_cpu.c
+++ b/src/tests/cpu/sb_cpu.c
@@ -27,6 +27,8 @@
# include <math.h>
#endif
+#include <inttypes.h>
+
#include "sysbench.h"
/* CPU test arguments */
@@ -42,6 +44,7 @@ static int cpu_init(void);
static void cpu_print_mode(void);
static sb_event_t cpu_next_event(int thread_id);
static int cpu_execute_event(sb_event_t *, int);
+static void cpu_report_cumulative(sb_stat_t *);
static int cpu_done(void);
static sb_test_t cpu_test =
@@ -53,6 +56,7 @@ static sb_test_t cpu_test =
.print_mode = cpu_print_mode,
.next_event = cpu_next_event,
.execute_event = cpu_execute_event,
+ .report_cumulative = cpu_report_cumulative,
.done = cpu_done
},
.args = cpu_args
@@ -124,6 +128,18 @@ void cpu_print_mode(void)
log_text(LOG_NOTICE, "Prime numbers limit: %d\n", max_prime);
}
+/* Print cumulative stats. */
+
+void cpu_report_cumulative(sb_stat_t *stat)
+{
+ log_text(LOG_NOTICE, "CPU speed:");
+ log_text(LOG_NOTICE, " events per second: %8.2f",
+ stat->events / stat->time_interval);
+
+ sb_report_cumulative(stat);
+}
+
+
int cpu_done(void)
{
return 0;
diff --git a/src/tests/fileio/sb_fileio.c b/src/tests/fileio/sb_fileio.c
index be1a18b..820bc9d 100644
--- a/src/tests/fileio/sb_fileio.c
+++ b/src/tests/fileio/sb_fileio.c
@@ -376,6 +376,7 @@ int file_prepare(void)
if (!VALID_FILE(files[i]))
{
log_errno(LOG_FATAL, "Cannot open file '%s'", file_name);
+ log_text(LOG_WARNING, "Did you forget to run the prepare step?");
return 1;
}
}
diff --git a/tests/t/api_reports.t b/tests/t/api_reports.t
index 3c6827f..8144cd6 100644
--- a/tests/t/api_reports.t
+++ b/tests/t/api_reports.t
@@ -21,8 +21,8 @@ Tests for custom report hooks
> EOF
$ sysbench $SB_ARGS run
- [ 2s ] thds: 1 tps: *.* qps: 0.00 (r/w/o: 0.00/0.00/0.00) lat (ms,95%): 1.* err/s 0.00 reconn/s: 0.00 (glob)
- [ 3s ] thds: 0 tps: *.* qps: 0.00 (r/w/o: 0.00/0.00/0.00) lat (ms,95%): 1.* err/s 0.00 reconn/s: 0.00 (glob)
+ \[ 2s \] thds: 1 tps: [0-9]*\.[0-9]* qps: 0\.00 \(r\/w\/o: 0\.00\/0\.00\/0\.00\) lat \(ms,95%\): [1-9][0-9]*\.[0-9]* err\/s 0\.00 reconn\/s: 0\.00 (re)
+ \[ 3s \] thds: 0 tps: [0-9]*\.[0-9]* qps: 0\.00 \(r\/w\/o: 0\.00\/0\.00\/0\.00\) lat \(ms,95%\): [1-9][0-9]*\.[0-9]* err\/s 0\.00 reconn\/s: 0\.00 (re)
########################################################################
# CSV format via a custom hook
@@ -40,8 +40,8 @@ Tests for custom report hooks
> EOF
$ sysbench $SB_ARGS run
- 2,1,*.*,0.00,0.00,0.00,0.00,1.*,0.00,0.00 (glob)
- 3,0,*.*,0.00,0.00,0.00,0.00,1.*,0.00,0.00 (glob)
+ 2,1,[0-9]*\.[0-9]*,0\.00,0\.00,0\.00,0\.00,[1-9][0-9]*\.[0-9]*,0\.00,0\.00 (re)
+ 3,0,[0-9]*\.[0-9]*,0\.00,0\.00,0\.00,0\.00,[1-9][0-9]*\.[0-9]*,0\.00,0\.00 (re)
########################################################################
# JSON format via a custom hook
@@ -67,9 +67,9 @@ Tests for custom report hooks
"total": 0.00,
"reads": 0.00,
"writes": 0.00,
- "other": 0.00,
+ "other": 0.00
},
- "latency": 1.*, (glob)
+ "latency": [1-9][0-9]*\.[0-9]*, (re)
"errors": 0.00,
"reconnects": 0.00
},
@@ -81,9 +81,9 @@ Tests for custom report hooks
"total": 0.00,
"reads": 0.00,
"writes": 0.00,
- "other": 0.00,
+ "other": 0.00
},
- "latency": 1.*, (glob)
+ "latency": [1-9][0-9]*\.[0-9]*, (re)
"errors": 0.00,
"reconnects": 0.00
},
diff --git a/tests/t/opt_help.t b/tests/t/opt_help.t
index 1e15619..08b8dc1 100644
--- a/tests/t/opt_help.t
+++ b/tests/t/opt_help.t
@@ -36,7 +36,7 @@ separately.
--rand-spec-pct=N percentage of values to be treated as 'special' (for special distribution) [1]
--rand-spec-res=N percentage of 'special' values to use (for special distribution) [75]
--rand-seed=N seed for random number generator. When 0, the current time is used as a RNG seed. [0]
- --rand-pareto-h=N parameter h for pareto distibution [0.2]
+ --rand-pareto-h=N parameter h for pareto distribution [0.2]
Log options:
--verbosity=N verbosity level {5 - debug, 0 - only critical messages} [3]
diff --git a/tests/t/test_cpu.t b/tests/t/test_cpu.t
index 645b205..61eb725 100644
--- a/tests/t/test_cpu.t
+++ b/tests/t/test_cpu.t
@@ -27,6 +27,8 @@ cpu benchmark tests
Threads started!
+ CPU speed:
+ events per second: *.* (glob)
General statistics:
total time: *s (glob)
diff --git a/tests/t/test_fileio.t b/tests/t/test_fileio.t
index 4c72d20..8fc249e 100644
--- a/tests/t/test_fileio.t
+++ b/tests/t/test_fileio.t
@@ -233,3 +233,8 @@ fileio benchmark tests
Removing test files...
$ ls
+
+ $ sysbench $fileio_args --file-test-mode=rndrw --verbosity=2 run
+ FATAL: Cannot open file 'test_file.0' errno = 2 (No such file or directory)
+ WARNING: Did you forget to run the prepare step?
+ [1]