0
0
Fork 0
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:
Jason Volk 2022-10-06 22:28:23 +00:00
parent 9682f406b3
commit 4c44125d37
2 changed files with 29 additions and 12 deletions

View file

@ -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:

View file

@ -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)
{