mirror of
https://github.com/matrix-construct/construct
synced 2024-05-19 19:33:45 +02:00
ircd::gpt::samp: Split dispatch branch into memfun.
This commit is contained in:
parent
9682f406b3
commit
4c44125d37
|
@ -38,6 +38,7 @@ struct ircd::gpt::samp
|
|||
void profile_accumulate(const pipe::prof &);
|
||||
bool retire(pipe::cycle &, const gpt::ctrl &);
|
||||
bool evaluate(pipe::cycle &);
|
||||
bool dispatche();
|
||||
uint tokenize();
|
||||
|
||||
public:
|
||||
|
|
40
ircd/gpt.cc
40
ircd/gpt.cc
|
@ -820,19 +820,8 @@ ircd::gpt::samp::operator()()
|
|||
{
|
||||
ctx::interruption_point();
|
||||
|
||||
if(dispatch > 0)
|
||||
{
|
||||
if(!cycle)
|
||||
ctrl.prof.released = prof::cycles();
|
||||
|
||||
queue.emplace_back(*this);
|
||||
desc.cached = tokens;
|
||||
tokens += count >= tokens;
|
||||
++cycle;
|
||||
++count;
|
||||
--dispatch;
|
||||
if(dispatche())
|
||||
return false;
|
||||
}
|
||||
|
||||
while(!queue.empty())
|
||||
{
|
||||
|
@ -944,6 +933,33 @@ ircd::gpt::samp::tokenize()
|
|||
return count;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::gpt::samp::dispatche()
|
||||
{
|
||||
if(!dispatch)
|
||||
return false;
|
||||
|
||||
assert(accept < 0);
|
||||
assert(count > 0);
|
||||
assert(tokens >= count);
|
||||
assert(cycle < count);
|
||||
assert(dispatch > 0);
|
||||
|
||||
if(cycle == 0)
|
||||
{
|
||||
ctrl.prof.acquired = 0;
|
||||
ctrl.prof.released = prof::cycles();
|
||||
}
|
||||
|
||||
queue.emplace_back(*this);
|
||||
desc.cached = tokens;
|
||||
tokens += count >= tokens;
|
||||
count += 1;
|
||||
cycle += 1;
|
||||
dispatch -= 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::gpt::samp::evaluate(pipe::cycle &cycle)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue