diff options
Diffstat (limited to 'src/support')
-rw-r--r-- | src/support/err.c | 39 | ||||
-rw-r--r-- | src/support/rand.c | 6 | ||||
-rw-r--r-- | src/support/stat.c | 12 | ||||
-rw-r--r-- | src/support/thread_group.c | 10 |
4 files changed, 32 insertions, 35 deletions
diff --git a/src/support/err.c b/src/support/err.c index 8bfac250b3a..3ecbab1cbe9 100644 --- a/src/support/err.c +++ b/src/support/err.c @@ -162,7 +162,6 @@ __wt_eventv(WT_SESSION_IMPL *session, bool msg_event, int error, WT_SESSION *wt_session; struct timespec ts; size_t len, remain, wlen; - int prefix_cnt; const char *err, *prefix; char *end, *p, tid[128]; @@ -211,44 +210,32 @@ __wt_eventv(WT_SESSION_IMPL *session, bool msg_event, int error, * name, and the session's name. Write them as a comma-separate list, * followed by a colon. */ - prefix_cnt = 0; - if (__wt_epoch(session, &ts) == 0) { - __wt_thread_id(tid, sizeof(tid)); - remain = WT_PTRDIFF(end, p); - wlen = (size_t)snprintf(p, remain, - "[%" PRIuMAX ":%" PRIuMAX "][%s]", - (uintmax_t)ts.tv_sec, - (uintmax_t)ts.tv_nsec / WT_THOUSAND, tid); - p = wlen >= remain ? end : p + wlen; - prefix_cnt = 1; - } + __wt_epoch(session, &ts); + __wt_thread_id(tid, sizeof(tid)); + remain = WT_PTRDIFF(end, p); + wlen = (size_t)snprintf(p, remain, "[%" PRIuMAX ":%" PRIuMAX "][%s]", + (uintmax_t)ts.tv_sec, (uintmax_t)ts.tv_nsec / WT_THOUSAND, tid); + p = wlen >= remain ? end : p + wlen; + if ((prefix = S2C(session)->error_prefix) != NULL) { remain = WT_PTRDIFF(end, p); - wlen = (size_t)snprintf(p, remain, - "%s%s", prefix_cnt == 0 ? "" : ", ", prefix); + wlen = (size_t)snprintf(p, remain, ", %s", prefix); p = wlen >= remain ? end : p + wlen; - prefix_cnt = 1; } prefix = session->dhandle == NULL ? NULL : session->dhandle->name; if (prefix != NULL) { remain = WT_PTRDIFF(end, p); - wlen = (size_t)snprintf(p, remain, - "%s%s", prefix_cnt == 0 ? "" : ", ", prefix); + wlen = (size_t)snprintf(p, remain, ", %s", prefix); p = wlen >= remain ? end : p + wlen; - prefix_cnt = 1; } if ((prefix = session->name) != NULL) { remain = WT_PTRDIFF(end, p); - wlen = (size_t)snprintf(p, remain, - "%s%s", prefix_cnt == 0 ? "" : ", ", prefix); - p = wlen >= remain ? end : p + wlen; - prefix_cnt = 1; - } - if (prefix_cnt != 0) { - remain = WT_PTRDIFF(end, p); - wlen = (size_t)snprintf(p, remain, ": "); + wlen = (size_t)snprintf(p, remain, ", %s", prefix); p = wlen >= remain ? end : p + wlen; } + remain = WT_PTRDIFF(end, p); + wlen = (size_t)snprintf(p, remain, ": "); + p = wlen >= remain ? end : p + wlen; if (file_name != NULL) { remain = WT_PTRDIFF(end, p); diff --git a/src/support/rand.c b/src/support/rand.c index d2e4cd27aab..025b18e4ed3 100644 --- a/src/support/rand.c +++ b/src/support/rand.c @@ -66,20 +66,18 @@ __wt_random_init(WT_RAND_STATE volatile * rnd_state) * threads and we want each thread to initialize its own random state based * on a different random seed. */ -int +void __wt_random_init_seed( WT_SESSION_IMPL *session, WT_RAND_STATE volatile * rnd_state) { struct timespec ts; WT_RAND_STATE rnd; - WT_RET(__wt_epoch(session, &ts)); + __wt_epoch(session, &ts); M_W(rnd) = (uint32_t)(ts.tv_nsec + 521288629); M_Z(rnd) = (uint32_t)(ts.tv_nsec + 362436069); *rnd_state = rnd; - - return (0); } /* diff --git a/src/support/stat.c b/src/support/stat.c index 7150223e6cb..9d440f9ebf3 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -706,6 +706,8 @@ static const char * const __stats_connection_desc[] = { "thread-state: active filesystem fsync calls", "thread-state: active filesystem read calls", "thread-state: active filesystem write calls", + "thread-yield: application thread time evicting (usecs)", + "thread-yield: application thread time waiting for cache (usecs)", "thread-yield: page acquire busy blocked", "thread-yield: page acquire eviction blocked", "thread-yield: page acquire locked blocked", @@ -723,6 +725,7 @@ static const char * const __stats_connection_desc[] = { "transaction: transaction checkpoint scrub time (msecs)", "transaction: transaction checkpoint total time (msecs)", "transaction: transaction checkpoints", + "transaction: transaction checkpoints skipped because database was clean", "transaction: transaction failures due to cache overflow", "transaction: transaction fsync calls for checkpoint after allocating the transaction ID", "transaction: transaction fsync duration for checkpoint after allocating the transaction ID (usecs)", @@ -950,6 +953,8 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats) /* not clearing thread_fsync_active */ /* not clearing thread_read_active */ /* not clearing thread_write_active */ + stats->application_evict_time = 0; + stats->application_cache_time = 0; stats->page_busy_blocked = 0; stats->page_forcible_evict_blocked = 0; stats->page_locked_blocked = 0; @@ -967,6 +972,7 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats) /* not clearing txn_checkpoint_scrub_time */ /* not clearing txn_checkpoint_time_total */ stats->txn_checkpoint = 0; + stats->txn_checkpoint_skipped = 0; stats->txn_fail_cache = 0; stats->txn_checkpoint_fsync_post = 0; /* not clearing txn_checkpoint_fsync_post_duration */ @@ -1242,6 +1248,10 @@ __wt_stat_connection_aggregate( to->thread_fsync_active += WT_STAT_READ(from, thread_fsync_active); to->thread_read_active += WT_STAT_READ(from, thread_read_active); to->thread_write_active += WT_STAT_READ(from, thread_write_active); + to->application_evict_time += + WT_STAT_READ(from, application_evict_time); + to->application_cache_time += + WT_STAT_READ(from, application_cache_time); to->page_busy_blocked += WT_STAT_READ(from, page_busy_blocked); to->page_forcible_evict_blocked += WT_STAT_READ(from, page_forcible_evict_blocked); @@ -1270,6 +1280,8 @@ __wt_stat_connection_aggregate( to->txn_checkpoint_time_total += WT_STAT_READ(from, txn_checkpoint_time_total); to->txn_checkpoint += WT_STAT_READ(from, txn_checkpoint); + to->txn_checkpoint_skipped += + WT_STAT_READ(from, txn_checkpoint_skipped); to->txn_fail_cache += WT_STAT_READ(from, txn_fail_cache); to->txn_checkpoint_fsync_post += WT_STAT_READ(from, txn_checkpoint_fsync_post); diff --git a/src/support/thread_group.c b/src/support/thread_group.c index f5ddabad7d4..a866d2d01c5 100644 --- a/src/support/thread_group.c +++ b/src/support/thread_group.c @@ -60,7 +60,7 @@ __thread_group_grow( while (group->current_threads < new_count) { thread = group->threads[group->current_threads++]; __wt_verbose(session, WT_VERB_THREAD_GROUP, - "Starting utility thread: %p:%"PRIu32"\n", + "Starting utility thread: %p:%" PRIu32, (void *)group, thread->id); F_SET(thread, WT_THREAD_RUN); WT_ASSERT(session, thread->session != NULL); @@ -100,7 +100,7 @@ __thread_group_shrink(WT_SESSION_IMPL *session, /* Wake threads to ensure they notice the state change */ if (thread->tid != 0) { __wt_verbose(session, WT_VERB_THREAD_GROUP, - "Stopping utility thread: %p:%"PRIu32"\n", + "Stopping utility thread: %p:%" PRIu32, (void *)group, thread->id); F_CLR(thread, WT_THREAD_RUN); __wt_cond_signal(session, group->wait_cond); @@ -224,7 +224,7 @@ __wt_thread_group_resize( __wt_verbose(session, WT_VERB_THREAD_GROUP, "Resize thread group: %p, from min: %" PRIu32 " -> %" PRIu32 - " from max: %" PRIu32 " -> %" PRIu32 "\n", + " from max: %" PRIu32 " -> %" PRIu32, (void *)group, group->min, new_min, group->max, new_max); __wt_writelock(session, group->lock); @@ -253,7 +253,7 @@ __wt_thread_group_create( cond_alloced = false; __wt_verbose(session, WT_VERB_THREAD_GROUP, - "Creating thread group: %p\n", (void *)group); + "Creating thread group: %p", (void *)group); WT_RET(__wt_rwlock_alloc(session, &group->lock, "Thread group")); WT_ERR(__wt_cond_alloc( @@ -286,7 +286,7 @@ __wt_thread_group_destroy(WT_SESSION_IMPL *session, WT_THREAD_GROUP *group) WT_DECL_RET; __wt_verbose(session, WT_VERB_THREAD_GROUP, - "Destroying thread group: %p\n", (void *)group); + "Destroying thread group: %p", (void *)group); WT_ASSERT(session, __wt_rwlock_islocked(session, group->lock)); |