diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-06-17 18:55:38 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-06-19 15:06:34 +0400 |
commit | 8f603bcbcac4a9091b6adbca3fd3655a947e759a (patch) | |
tree | a1933d1f9e4ed69b7903d5018b584205c4d80510 /sql/mdl.cc | |
parent | 2bc6e29afeea374aa0ef4bc36c7a7b649c20d959 (diff) | |
download | mariadb-git-8f603bcbcac4a9091b6adbca3fd3655a947e759a.tar.gz |
MDEV-7952 - clock_gettime() takes 0.24% in OLTP RO
Initialize abs_timeout when it is about to be used. This saves one my_hrtime()
call on hot path (when we acquire MDL lock without waiting).
When filling I_S.PROCESSLIST use THD::start_utime/THD::utime_after_query instead
of THD::start_time. This allows us to save 2 clock_gettime() calls.
Overhead change:
__clock_gettime 0.13% -> 0.11% (122 -> 76 calls per OLTP RO transaction)
my_interval_timer 0.07% -> 0.06%
my_hrtime 0.04% -> 0.01%
Diffstat (limited to 'sql/mdl.cc')
-rw-r--r-- | sql/mdl.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sql/mdl.cc b/sql/mdl.cc index 55e39d0ee0a..dc18dea1b5a 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1972,14 +1972,10 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) { MDL_lock *lock; MDL_ticket *ticket; - struct timespec abs_timeout; MDL_wait::enum_wait_status wait_status; DBUG_ENTER("MDL_context::acquire_lock"); DBUG_PRINT("enter", ("lock_type: %d", mdl_request->type)); - /* Do some work outside the critical section. */ - set_timespec(abs_timeout, lock_wait_timeout); - if (try_acquire_lock_impl(mdl_request, &ticket)) DBUG_RETURN(TRUE); @@ -2028,7 +2024,8 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) find_deadlock(); - struct timespec abs_shortwait; + struct timespec abs_timeout, abs_shortwait; + set_timespec(abs_timeout, lock_wait_timeout); set_timespec(abs_shortwait, 1); wait_status= MDL_wait::EMPTY; |