From f6daa31d1530c3e0070a315db3403cb32db2e600 Mon Sep 17 00:00:00 2001 From: Alexey Kopytov Date: Fri, 23 Mar 2012 18:25:09 +0400 Subject: [PATCH] Fixed a spurious "timer was never started" warning. --- sysbench/db_driver.c | 2 +- sysbench/sb_timer.c | 6 ++++++ sysbench/sb_timer.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sysbench/db_driver.c b/sysbench/db_driver.c index 213b64d..f442e4f 100644 --- a/sysbench/db_driver.c +++ b/sysbench/db_driver.c @@ -992,7 +992,7 @@ static void db_reset_stats(void) So that intermediate stats are calculated from the current moment rather than from the previous intermediate report */ - if (sb_timer_initialized(&sb_globals.exec_timer)) + if (sb_timer_running(&sb_globals.exec_timer)) sb_timer_split(&sb_globals.exec_timer); if (sb_globals.debug) diff --git a/sysbench/sb_timer.c b/sysbench/sb_timer.c index 38a7316..e09f931 100644 --- a/sysbench/sb_timer.c +++ b/sysbench/sb_timer.c @@ -69,6 +69,12 @@ int sb_timer_initialized(sb_timer_t *t) return t->state != TIMER_UNINITIALIZED; } +/* check whether the timer is running */ +int sb_timer_running(sb_timer_t *t) +{ + return t->state != TIMER_RUNNING; +} + /* start timer */ diff --git a/sysbench/sb_timer.h b/sysbench/sb_timer.h index bca463b..3387790 100644 --- a/sysbench/sb_timer.h +++ b/sysbench/sb_timer.h @@ -93,6 +93,9 @@ void sb_timer_reset(sb_timer_t *t); /* check whether the timer is initialized */ int sb_timer_initialized(sb_timer_t *t); +/* check whether the timer is running */ +int sb_timer_running(sb_timer_t *t); + /* start timer */ void sb_timer_start(sb_timer_t *);