@@ -104,14 +104,15 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
104104 WT_CONNECTION_IMPL * conn ;
105105 WT_DECL_RET ;
106106 WT_PAGE * page ;
107- uint64_t time_start , time_stop ;
107+ uint64_t eviction_time , eviction_time_seconds ;
108108 bool clean_page , closing , force_evict_hs , inmem_split , local_gen , tree_dead ;
109109
110110 conn = S2C (session );
111111 page = ref -> page ;
112112 closing = LF_ISSET (WT_EVICT_CALL_CLOSING );
113113 force_evict_hs = false;
114114 local_gen = false;
115+ eviction_time = eviction_time_seconds = 0 ;
115116
116117 __wt_verbose (
117118 session , WT_VERB_EVICT , "page %p (%s)" , (void * )page , __wt_page_type_string (page -> type ));
@@ -129,13 +130,14 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
129130 __wt_session_gen_enter (session , WT_GEN_EVICT );
130131 }
131132
133+ WT_CLEAR (session -> reconcile_timeline );
134+ WT_CLEAR (session -> evict_timeline );
135+ session -> evict_timeline .evict_start = __wt_clock (session );
132136 /*
133- * Track how long forcible eviction took. Immediately increment the forcible eviction counter,
134- * we might do an in-memory split and not an eviction, which skips the other statistics.
137+ * Immediately increment the forcible eviction counter, we might do an in-memory split and not
138+ * an eviction, which skips the other statistics.
135139 */
136- time_start = 0 ;
137140 if (LF_ISSET (WT_EVICT_CALL_URGENT )) {
138- time_start = __wt_clock (session );
139141 WT_STAT_CONN_INCR (session , cache_eviction_force );
140142
141143 /*
@@ -227,19 +229,18 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
227229 * We have loaded the new disk image and updated the tree structure. We can no longer fail after
228230 * this point.
229231 */
230-
231- if (time_start != 0 ) {
232- time_stop = __wt_clock (session );
232+ session -> evict_timeline .evict_finish = __wt_clock (session );
233+ eviction_time =
234+ WT_CLOCKDIFF_US (session -> evict_timeline .evict_finish , session -> evict_timeline .evict_start );
235+ if (LF_ISSET (WT_EVICT_CALL_URGENT )) {
233236 if (force_evict_hs )
234237 WT_STAT_CONN_INCR (session , cache_eviction_force_hs_success );
235238 if (clean_page ) {
236239 WT_STAT_CONN_INCR (session , cache_eviction_force_clean );
237- WT_STAT_CONN_INCRV (
238- session , cache_eviction_force_clean_time , WT_CLOCKDIFF_US (time_stop , time_start ));
240+ WT_STAT_CONN_INCRV (session , cache_eviction_force_clean_time , eviction_time );
239241 } else {
240242 WT_STAT_CONN_INCR (session , cache_eviction_force_dirty );
241- WT_STAT_CONN_INCRV (
242- session , cache_eviction_force_dirty_time , WT_CLOCKDIFF_US (time_stop , time_start ));
243+ WT_STAT_CONN_INCRV (session , cache_eviction_force_dirty_time , eviction_time );
243244 }
244245 }
245246 if (clean_page )
@@ -255,20 +256,32 @@ __wt_evict(WT_SESSION_IMPL *session, WT_REF *ref, uint8_t previous_state, uint32
255256err :
256257 if (!closing )
257258 __evict_exclusive_clear (session , ref , previous_state );
258-
259- if (time_start != 0 ) {
260- time_stop = __wt_clock (session );
259+ session -> evict_timeline .evict_finish = __wt_clock (session );
260+ eviction_time = WT_CLOCKDIFF_US (
261+ session -> evict_timeline .evict_finish , session -> evict_timeline .evict_start );
262+ if (LF_ISSET (WT_EVICT_CALL_URGENT )) {
261263 if (force_evict_hs )
262264 WT_STAT_CONN_INCR (session , cache_eviction_force_hs_fail );
263265 WT_STAT_CONN_INCR (session , cache_eviction_force_fail );
264- WT_STAT_CONN_INCRV (
265- session , cache_eviction_force_fail_time , WT_CLOCKDIFF_US (time_stop , time_start ));
266+ WT_STAT_CONN_INCRV (session , cache_eviction_force_fail_time , eviction_time );
266267 }
267268
268269 WT_STAT_CONN_DATA_INCR (session , cache_eviction_fail );
269270 }
270271
271272done :
273+ eviction_time_seconds = eviction_time / WT_MILLION ;
274+ if (eviction_time_seconds > conn -> cache -> evict_max_seconds )
275+ conn -> cache -> evict_max_seconds = eviction_time_seconds ;
276+ if (eviction_time_seconds > 60 )
277+ __wt_verbose_warning (session , WT_VERB_EVICT ,
278+ "Eviction took more than 1 minute (%" PRIu64 "). Building disk image took %" PRIu64
279+ "us. History store wrapup took %" PRIu64 "us." ,
280+ eviction_time ,
281+ WT_CLOCKDIFF_US (session -> reconcile_timeline .image_build_finish ,
282+ session -> reconcile_timeline .image_build_start ),
283+ WT_CLOCKDIFF_US (session -> reconcile_timeline .hs_wrapup_finish ,
284+ session -> reconcile_timeline .hs_wrapup_start ));
272285 /* Leave any local eviction generation. */
273286 if (local_gen )
274287 __wt_session_gen_leave (session , WT_GEN_EVICT );
0 commit comments