summaryrefslogtreecommitdiff
path: root/sql/threadpool_common.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2019-05-26 13:25:12 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2019-05-26 19:20:35 +0200
commit2fc13d04d16f878ed693ad8ba56045b79ccb9650 (patch)
tree23cbb2dbe934d4879cae668b0164dbec0ba71503 /sql/threadpool_common.cc
parent5f18bd3a3545bae97956fbbf4b29d2e9288a6505 (diff)
downloadmariadb-git-2fc13d04d16f878ed693ad8ba56045b79ccb9650.tar.gz
MDEV-19313 Threadpool : provide information schema tables for internals of generic threadpool
Added thread_pool_groups, thread_pool_queues, thread_pool_waits and thread_pool_stats tables to information_schema.
Diffstat (limited to 'sql/threadpool_common.cc')
-rw-r--r--sql/threadpool_common.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 3628ceb9112..0cbd076016d 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -23,7 +23,7 @@
#include <sql_audit.h>
#include <debug_sync.h>
#include <threadpool.h>
-
+#include <my_counter.h>
/* Threadpool parameters */
@@ -153,9 +153,8 @@ static TP_PRIORITY get_priority(TP_connection *c)
DBUG_ASSERT(c->thd == current_thd);
TP_PRIORITY prio= (TP_PRIORITY)c->thd->variables.threadpool_priority;
if (prio == TP_PRIORITY_AUTO)
- {
- return c->thd->transaction.is_active() ? TP_PRIORITY_HIGH : TP_PRIORITY_LOW;
- }
+ prio= c->thd->transaction.is_active() ? TP_PRIORITY_HIGH : TP_PRIORITY_LOW;
+
return prio;
}
@@ -463,12 +462,17 @@ void tp_timeout_handler(TP_connection *c)
mysql_mutex_unlock(&thd->LOCK_thd_kill);
}
+MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) Atomic_counter<unsigned long long> tp_waits[THD_WAIT_LAST];
static void tp_wait_begin(THD *thd, int type)
{
TP_connection *c = get_TP_connection(thd);
if (c)
+ {
+ DBUG_ASSERT(type > 0 && type < THD_WAIT_LAST);
+ tp_waits[type]++;
c->wait_begin(type);
+ }
}