mirror of
https://github.com/matrix-construct/construct
synced 2024-06-11 14:38:57 +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 &);
|
void profile_accumulate(const pipe::prof &);
|
||||||
bool retire(pipe::cycle &, const gpt::ctrl &);
|
bool retire(pipe::cycle &, const gpt::ctrl &);
|
||||||
bool evaluate(pipe::cycle &);
|
bool evaluate(pipe::cycle &);
|
||||||
|
bool dispatche();
|
||||||
uint tokenize();
|
uint tokenize();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
40
ircd/gpt.cc
40
ircd/gpt.cc
|
@ -820,19 +820,8 @@ ircd::gpt::samp::operator()()
|
||||||
{
|
{
|
||||||
ctx::interruption_point();
|
ctx::interruption_point();
|
||||||
|
|
||||||
if(dispatch > 0)
|
if(dispatche())
|
||||||
{
|
|
||||||
if(!cycle)
|
|
||||||
ctrl.prof.released = prof::cycles();
|
|
||||||
|
|
||||||
queue.emplace_back(*this);
|
|
||||||
desc.cached = tokens;
|
|
||||||
tokens += count >= tokens;
|
|
||||||
++cycle;
|
|
||||||
++count;
|
|
||||||
--dispatch;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
while(!queue.empty())
|
while(!queue.empty())
|
||||||
{
|
{
|
||||||
|
@ -944,6 +933,33 @@ ircd::gpt::samp::tokenize()
|
||||||
return count;
|
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
|
bool
|
||||||
ircd::gpt::samp::evaluate(pipe::cycle &cycle)
|
ircd::gpt::samp::evaluate(pipe::cycle &cycle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue