summaryrefslogtreecommitdiff
path: root/source3/utils/dbwrap_torture.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-11-24 10:36:52 +0100
committerStefan Metzmacher <metze@samba.org>2009-11-24 11:47:31 +0100
commit14d2ca26b3abd0feb20f270c66847b7b2c17cb0a (patch)
tree351da08fa67f684923abdec30c177fdc6efcba68 /source3/utils/dbwrap_torture.c
parent23d81904ebafffebec803c2e43bc645dedc88f8e (diff)
downloadsamba-14d2ca26b3abd0feb20f270c66847b7b2c17cb0a.tar.gz
s3:dbwrap_torture: use timeval_current/timeval_elapsed instead of start_timer/end_timer
metze
Diffstat (limited to 'source3/utils/dbwrap_torture.c')
-rw-r--r--source3/utils/dbwrap_torture.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c
index 2077eea5678..a6e2d2bc2c3 100644
--- a/source3/utils/dbwrap_torture.c
+++ b/source3/utils/dbwrap_torture.c
@@ -33,20 +33,6 @@
extern bool AllowDebugChange;
-static struct timeval tp1,tp2;
-
-static void start_timer(void)
-{
- gettimeofday(&tp1,NULL);
-}
-
-static double end_timer(void)
-{
- gettimeofday(&tp2,NULL);
- return (tp2.tv_sec + (tp2.tv_usec*1.0e-6)) -
- (tp1.tv_sec + (tp1.tv_usec*1.0e-6));
-}
-
#define DEFAULT_DB_NAME "transaction.tdb"
static int timelimit = 10;
@@ -138,12 +124,13 @@ static void test_store_records(struct db_context *db, struct tevent_context *ev)
TDB_DATA key;
uint32_t *counters;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
+ struct timeval start;
key.dptr = (unsigned char *)discard_const("testkey");
key.dsize = strlen((const char *)key.dptr)+1;
- start_timer();
- while ((timelimit == 0) || (end_timer() < timelimit)) {
+ start = timeval_current();
+ while ((timelimit == 0) || (timeval_elapsed(&start) < timelimit)) {
struct db_record *rec;
TDB_DATA data;
int ret;