0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-26 13:58:18 +02:00

ircd::db: Add a counter for the env pool tasks.

This commit is contained in:
Jason Volk 2018-12-31 16:12:10 -08:00
parent b169f0cc80
commit eba727a9db
2 changed files with 10 additions and 3 deletions

View file

@ -39,6 +39,7 @@ struct ircd::db::database::env::state::pool
Priority pri;
IOPriority iopri;
ctx::dock dock;
uint64_t taskctr {0};
std::deque<task> tasks;
ctx::pool::opts popts;
ctx::pool p;
@ -58,4 +59,5 @@ struct ircd::db::database::env::state::task
void (*func)(void *arg);
void (*cancel)(void *arg);
void *arg;
uint64_t _id {0};
};

View file

@ -7637,6 +7637,8 @@ ircd::db::database::env::state::pool::wait()
void
ircd::db::database::env::state::pool::operator()(task &&task)
{
assert(task._id == 0);
task._id = ++taskctr;
tasks.emplace_back(std::move(task));
p([this]
{
@ -7655,10 +7657,11 @@ ircd::db::database::env::state::pool::operator()(task &&task)
log::debug
{
log, "'%s': pool:%s tasks:%zu starting func:%p arg:%p",
log, "'%s': pool:%s queue:%zu starting task:%lu func:%p arg:%p",
this->d.name,
ctx::name(p),
tasks.size(),
task._id,
task.func,
task.arg,
};
@ -7676,10 +7679,11 @@ ircd::db::database::env::state::pool::operator()(task &&task)
log::debug
{
log, "'%s': pool:%s tasks:%zu task finished func:%p arg:%p",
log, "'%s': pool:%s queue:%zu finished task:%zu func:%p arg:%p",
this->d.name,
ctx::name(p),
tasks.size(),
task._id,
task.func,
task.arg,
};
@ -7698,11 +7702,12 @@ ircd::db::database::env::state::pool::cancel(void *const &tag)
auto &task(*it);
log::debug
{
log, "'%s': pool:%s tasks:%zu cancel %zu func:%p cancel:%p arg:%p tag:%p",
log, "'%s': pool:%s tasks:%zu cancel#%zu task:%lu func:%p cancel:%p arg:%p tag:%p",
d.name,
ctx::name(p),
tasks.size(),
i,
task._id,
task.func,
task.cancel,
task.arg,