Permalink
Browse files

Limit spin lock hold time to reading the counter. It isn't clear to m…

…e that it needs to be

held for a longer time and valgrind gets stuck in less than 60 seconds during rocksdb_bench
without this change.
  • Loading branch information...
mdcallag committed May 25, 2015
1 parent e966868 commit a6f8d841ab1fcc27f668f207fc9df863fd145f55
Showing with 1 addition and 2 deletions.
  1. +1 −2 bench/couch_bench.cc
View
@@ -397,6 +397,7 @@ void * pop_print_time(void *voidargs)
while (counter < binfo->ndocs) {
spin_lock(args->lock);
counter = *(args->counter);
+ spin_unlock(args->lock);
if (stopwatch_check_ms(args->sw, print_term_ms)) {
tv = stopwatch_get_curtime(args->sw_long);
tv_i = stopwatch_get_curtime(args->sw);
@@ -429,7 +430,6 @@ void * pop_print_time(void *voidargs)
// total amount of data written
printf("%s) ", print_filesize_approx(bytes_written, buf));
printf(" (-%d s)", (int)remain_sec);
- spin_unlock(args->lock);
fflush(stdout);
if (log_fp) {
@@ -439,7 +439,6 @@ void * pop_print_time(void *voidargs)
iops, iops_i, (uint64_t)counter, bytes_written);
}
} else {
- spin_unlock(args->lock);
usleep(print_term_ms * 1000);
}
}

0 comments on commit a6f8d84

Please sign in to comment.