OpenSDN source code
TaskGroup Class Reference

TaskGroup maintains per <task-id> information including,. More...

Collaboration diagram for TaskGroup:

Public Member Functions

 TaskGroup (int task_id)
 
 ~TaskGroup ()
 
TaskEntryQueryTaskEntry (int task_instance) const
 
TaskEntryGetTaskEntry (int task_instance)
 
void AddPolicy (TaskGroup *group)
 
void AddToDeferQ (TaskEntry *entry)
 Add task to deferq_ Only one task of a given instance goes into deferq_ for its policies. More...
 
void AddToDisableQ (TaskEntry *entry)
 Enqueue TaskEntry in disable_entry's deferQ. More...
 
void AddEntriesToDisableQ ()
 Add TaskEntries to disable_entry_ which have tasks enqueued and are already disabled. More...
 
TaskEntryGetDisableEntry ()
 
void DeleteFromDeferQ (TaskEntry &entry)
 Delete task from deferq_. More...
 
TaskGroupActiveGroupInPolicy ()
 
bool DeferOnPolicyFail (TaskEntry *entry, Task *t)
 
bool IsWaitQEmpty ()
 Returns true, if the waiq_ of all the tasks in the group are empty. More...
 
int TaskRunCount () const
 
void RunDeferQ ()
 Starts executing tasks from deferq_ of a TaskGroup. More...
 
void RunDisableEntries ()
 Run tasks that maybe suspended. Schedule tasks only for TaskEntries which are enabled. More...
 
void TaskExited (Task *t)
 
void PolicySet ()
 
void TaskStarted ()
 
void IncrementTotalRunTime (int64_t rtime)
 
TaskStatsGetTaskGroupStats ()
 
TaskStatsGetTaskStats ()
 
TaskStatsGetTaskStats (int task_instance)
 
void ClearTaskGroupStats ()
 
void ClearTaskStats ()
 
void ClearTaskStats (int instance_id)
 
void SetDisable (bool disable)
 
bool IsDisabled ()
 
void GetSandeshData (SandeshTaskGroup *resp, bool summary) const
 
int task_id () const
 
size_t deferq_size () const
 
size_t num_tasks () const
 
oneapi::tbb::task_group & tbb_group ()
 

Private Types

typedef std::vector< TaskGroup * > TaskGroupPolicyList
 Vector of Task Group policies. More...
 
typedef boost::intrusive::member_hook< TaskEntry, boost::intrusive::set_member_hook<>, &TaskEntry::task_defer_nodeTaskDeferListOption
 
typedef boost::intrusive::set< TaskEntry, TaskDeferListOption, boost::intrusive::compare< TaskDeferEntryCmp > > TaskDeferList
 It is a tree of TaskEntries deferred and waiting on the containing task to exit. The tree is sorted by seqno_ of first task in the TaskEntry. More...
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (TaskGroup)
 

Private Attributes

int task_code_id_
 
oneapi::tbb::task_group tbb_group_
 A TBB object to store executing tasks. More...
 
bool policy_set_
 Specifies if policy is already set. More...
 
int run_count_
 No. of tasks running in the group. More...
 
std::atomic< uint64_t > total_run_time_
 
TaskGroupPolicyList policy_
 Policy rules for the group. More...
 
TaskDeferList deferq_
 Tasks deferred till run_count_ is 0. More...
 
TaskEntrytask_entry_
 Tasks deferred till run_count_ is 0. More...
 
TaskEntrydisable_entry_
 Task entry for disabled group. More...
 
TaskEntryList task_entry_db_
 task-entries in this group More...
 
uint32_t execute_delay_
 
uint32_t schedule_delay_
 
bool disable_
 
TaskStats stats_
 

Static Private Attributes

static const int kVectorGrowSize = 16
 

Friends

class TaskEntry
 
class TaskScheduler
 

Detailed Description

TaskGroup maintains per <task-id> information including,.

polic_set_ : Boolean used to ensure policy is set only once per task Task policy change is not yet supported

policy_ : List of policy rules for the task

run_count_ : Number of tasks running in context of this task-group

deferq_ : Tasks deferred till run_count_ on this task becomes 0

task_entry_ : Default TaskEntry used for task without an instance

disable_entry_ : TaskEntry which maintains a deferQ for tasks enqueued while TaskGroup is disabled

Definition at line 240 of file task.cc.

Member Typedef Documentation

◆ TaskDeferList

It is a tree of TaskEntries deferred and waiting on the containing task to exit. The tree is sorted by seqno_ of first task in the TaskEntry.

Definition at line 329 of file task.cc.

◆ TaskDeferListOption

typedef boost::intrusive::member_hook<TaskEntry, boost::intrusive::set_member_hook<>, &TaskEntry::task_defer_node> TaskGroup::TaskDeferListOption
private

Definition at line 323 of file task.cc.

◆ TaskGroupPolicyList

typedef std::vector<TaskGroup *> TaskGroup::TaskGroupPolicyList
private

Vector of Task Group policies.

Definition at line 320 of file task.cc.

Constructor & Destructor Documentation

◆ TaskGroup()

TaskGroup::TaskGroup ( int  task_id)

Definition at line 1030 of file task.cc.

Here is the call graph for this function:

◆ ~TaskGroup()

TaskGroup::~TaskGroup ( )

Definition at line 1040 of file task.cc.

Member Function Documentation

◆ ActiveGroupInPolicy()

TaskGroup * TaskGroup::ActiveGroupInPolicy ( )

Definition at line 1092 of file task.cc.

◆ AddEntriesToDisableQ()

void TaskGroup::AddEntriesToDisableQ ( )

Add TaskEntries to disable_entry_ which have tasks enqueued and are already disabled.

Definition at line 1163 of file task.cc.

Here is the call graph for this function:

◆ AddPolicy()

void TaskGroup::AddPolicy ( TaskGroup group)

Definition at line 1088 of file task.cc.

◆ AddToDeferQ()

void TaskGroup::AddToDeferQ ( TaskEntry entry)

Add task to deferq_ Only one task of a given instance goes into deferq_ for its policies.

Definition at line 1118 of file task.cc.

◆ AddToDisableQ()

void TaskGroup::AddToDisableQ ( TaskEntry entry)

Enqueue TaskEntry in disable_entry's deferQ.

Definition at line 1131 of file task.cc.

Here is the call graph for this function:

◆ ClearTaskGroupStats()

void TaskGroup::ClearTaskGroupStats ( )

Definition at line 1207 of file task.cc.

◆ ClearTaskStats() [1/2]

void TaskGroup::ClearTaskStats ( )

Definition at line 1211 of file task.cc.

Here is the call graph for this function:

◆ ClearTaskStats() [2/2]

void TaskGroup::ClearTaskStats ( int  instance_id)

Definition at line 1215 of file task.cc.

Here is the call graph for this function:

◆ DeferOnPolicyFail()

bool TaskGroup::DeferOnPolicyFail ( TaskEntry entry,
Task t 
)

Definition at line 1102 of file task.cc.

Here is the call graph for this function:

◆ deferq_size()

size_t TaskGroup::deferq_size ( ) const
inline

Definition at line 299 of file task.cc.

◆ DeleteFromDeferQ()

void TaskGroup::DeleteFromDeferQ ( TaskEntry entry)

Delete task from deferq_.

Definition at line 1125 of file task.cc.

◆ DISALLOW_COPY_AND_ASSIGN()

TaskGroup::DISALLOW_COPY_AND_ASSIGN ( TaskGroup  )
private

◆ GetDisableEntry()

TaskEntry* TaskGroup::GetDisableEntry ( )
inline

Definition at line 260 of file task.cc.

◆ GetSandeshData()

void TaskGroup::GetSandeshData ( SandeshTaskGroup *  resp,
bool  summary 
) const

Definition at line 1555 of file task.cc.

Here is the call graph for this function:

◆ GetTaskEntry()

TaskEntry * TaskGroup::GetTaskEntry ( int  task_instance)

Definition at line 1059 of file task.cc.

◆ GetTaskGroupStats()

TaskStats * TaskGroup::GetTaskGroupStats ( )

Definition at line 1221 of file task.cc.

◆ GetTaskStats() [1/2]

TaskStats * TaskGroup::GetTaskStats ( )

Definition at line 1225 of file task.cc.

Here is the call graph for this function:

◆ GetTaskStats() [2/2]

TaskStats * TaskGroup::GetTaskStats ( int  task_instance)

Definition at line 1229 of file task.cc.

Here is the call graph for this function:

◆ IncrementTotalRunTime()

void TaskGroup::IncrementTotalRunTime ( int64_t  rtime)
inline

Definition at line 287 of file task.cc.

◆ IsDisabled()

bool TaskGroup::IsDisabled ( )
inline

Definition at line 295 of file task.cc.

◆ IsWaitQEmpty()

bool TaskGroup::IsWaitQEmpty ( )

Returns true, if the waiq_ of all the tasks in the group are empty.

Note: This function is invoked from TaskScheduler::IsEmpty() for each task group and is intended to be invoked only in the test code. If this function needs to be used outside test code, then we may want to consider storing the waitq_ count for performance reason.

Definition at line 1181 of file task.cc.

Here is the call graph for this function:

◆ num_tasks()

size_t TaskGroup::num_tasks ( ) const
inline

Definition at line 300 of file task.cc.

◆ PolicySet()

void TaskGroup::PolicySet ( )

Definition at line 1135 of file task.cc.

◆ QueryTaskEntry()

TaskEntry * TaskGroup::QueryTaskEntry ( int  task_instance) const

Definition at line 1077 of file task.cc.

◆ RunDeferQ()

void TaskGroup::RunDeferQ ( )

Starts executing tasks from deferq_ of a TaskGroup.

Definition at line 1140 of file task.cc.

Here is the call graph for this function:

◆ RunDisableEntries()

void TaskGroup::RunDisableEntries ( )

Run tasks that maybe suspended. Schedule tasks only for TaskEntries which are enabled.

Definition at line 1159 of file task.cc.

Here is the call graph for this function:

◆ SetDisable()

void TaskGroup::SetDisable ( bool  disable)
inline

Definition at line 294 of file task.cc.

◆ task_id()

int TaskGroup::task_id ( ) const
inline

Definition at line 298 of file task.cc.

◆ TaskExited()

void TaskGroup::TaskExited ( Task t)
inline

Definition at line 1154 of file task.cc.

◆ TaskRunCount()

int TaskGroup::TaskRunCount ( ) const
inline

Definition at line 276 of file task.cc.

◆ TaskStarted()

void TaskGroup::TaskStarted ( )
inline

Definition at line 286 of file task.cc.

◆ tbb_group()

oneapi::tbb::task_group& TaskGroup::tbb_group ( )
inline

Definition at line 311 of file task.cc.

Friends And Related Function Documentation

◆ TaskEntry

friend class TaskEntry
friend

Definition at line 316 of file task.cc.

◆ TaskScheduler

friend class TaskScheduler
friend

Definition at line 317 of file task.cc.

Member Data Documentation

◆ deferq_

TaskDeferList TaskGroup::deferq_
private

Tasks deferred till run_count_ is 0.

Definition at line 348 of file task.cc.

◆ disable_

bool TaskGroup::disable_
private

Definition at line 360 of file task.cc.

◆ disable_entry_

TaskEntry* TaskGroup::disable_entry_
private

Task entry for disabled group.

Definition at line 354 of file task.cc.

◆ execute_delay_

uint32_t TaskGroup::execute_delay_
private

Definition at line 358 of file task.cc.

◆ kVectorGrowSize

const int TaskGroup::kVectorGrowSize = 16
staticprivate

Definition at line 331 of file task.cc.

◆ policy_

TaskGroupPolicyList TaskGroup::policy_
private

Policy rules for the group.

Definition at line 345 of file task.cc.

◆ policy_set_

bool TaskGroup::policy_set_
private

Specifies if policy is already set.

Definition at line 338 of file task.cc.

◆ run_count_

int TaskGroup::run_count_
private

No. of tasks running in the group.

Definition at line 341 of file task.cc.

◆ schedule_delay_

uint32_t TaskGroup::schedule_delay_
private

Definition at line 359 of file task.cc.

◆ stats_

TaskStats TaskGroup::stats_
private

Definition at line 362 of file task.cc.

◆ task_code_id_

int TaskGroup::task_code_id_
private

Definition at line 332 of file task.cc.

◆ task_entry_

TaskEntry* TaskGroup::task_entry_
private

Tasks deferred till run_count_ is 0.

Definition at line 351 of file task.cc.

◆ task_entry_db_

TaskEntryList TaskGroup::task_entry_db_
private

task-entries in this group

Definition at line 357 of file task.cc.

◆ tbb_group_

oneapi::tbb::task_group TaskGroup::tbb_group_
private

A TBB object to store executing tasks.

Definition at line 335 of file task.cc.

◆ total_run_time_

std::atomic<uint64_t> TaskGroup::total_run_time_
private

Definition at line 342 of file task.cc.


The documentation for this class was generated from the following file: