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
 

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_
 
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 229 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 314 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 308 of file task.cc.

◆ TaskGroupPolicyList

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

Vector of Task Group policies.

Definition at line 305 of file task.cc.

Constructor & Destructor Documentation

◆ TaskGroup()

TaskGroup::TaskGroup ( int  task_id)

Definition at line 1061 of file task.cc.

Here is the call graph for this function:

◆ ~TaskGroup()

TaskGroup::~TaskGroup ( )

Definition at line 1070 of file task.cc.

Member Function Documentation

◆ ActiveGroupInPolicy()

TaskGroup * TaskGroup::ActiveGroupInPolicy ( )

Definition at line 1122 of file task.cc.

◆ AddEntriesToDisableQ()

void TaskGroup::AddEntriesToDisableQ ( )

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

Definition at line 1193 of file task.cc.

Here is the call graph for this function:

◆ AddPolicy()

void TaskGroup::AddPolicy ( TaskGroup group)

Definition at line 1118 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 1148 of file task.cc.

◆ AddToDisableQ()

void TaskGroup::AddToDisableQ ( TaskEntry entry)

Enqueue TaskEntry in disable_entry's deferQ.

Definition at line 1161 of file task.cc.

Here is the call graph for this function:

◆ ClearTaskGroupStats()

void TaskGroup::ClearTaskGroupStats ( )

Definition at line 1237 of file task.cc.

◆ ClearTaskStats() [1/2]

void TaskGroup::ClearTaskStats ( )

Definition at line 1241 of file task.cc.

Here is the call graph for this function:

◆ ClearTaskStats() [2/2]

void TaskGroup::ClearTaskStats ( int  instance_id)

Definition at line 1245 of file task.cc.

Here is the call graph for this function:

◆ DeferOnPolicyFail()

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

Definition at line 1132 of file task.cc.

Here is the call graph for this function:

◆ deferq_size()

size_t TaskGroup::deferq_size ( ) const
inline

Definition at line 288 of file task.cc.

◆ DeleteFromDeferQ()

void TaskGroup::DeleteFromDeferQ ( TaskEntry entry)

Delete task from deferq_.

Definition at line 1155 of file task.cc.

◆ DISALLOW_COPY_AND_ASSIGN()

TaskGroup::DISALLOW_COPY_AND_ASSIGN ( TaskGroup  )
private

◆ GetDisableEntry()

TaskEntry* TaskGroup::GetDisableEntry ( )
inline

Definition at line 249 of file task.cc.

◆ GetSandeshData()

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

Definition at line 1590 of file task.cc.

Here is the call graph for this function:

◆ GetTaskEntry()

TaskEntry * TaskGroup::GetTaskEntry ( int  task_instance)

Definition at line 1089 of file task.cc.

◆ GetTaskGroupStats()

TaskStats * TaskGroup::GetTaskGroupStats ( )

Definition at line 1251 of file task.cc.

◆ GetTaskStats() [1/2]

TaskStats * TaskGroup::GetTaskStats ( )

Definition at line 1255 of file task.cc.

Here is the call graph for this function:

◆ GetTaskStats() [2/2]

TaskStats * TaskGroup::GetTaskStats ( int  task_instance)

Definition at line 1259 of file task.cc.

Here is the call graph for this function:

◆ IncrementTotalRunTime()

void TaskGroup::IncrementTotalRunTime ( int64_t  rtime)
inline

Definition at line 276 of file task.cc.

◆ IsDisabled()

bool TaskGroup::IsDisabled ( )
inline

Definition at line 284 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 1211 of file task.cc.

Here is the call graph for this function:

◆ num_tasks()

size_t TaskGroup::num_tasks ( ) const
inline

Definition at line 289 of file task.cc.

◆ PolicySet()

void TaskGroup::PolicySet ( )

Definition at line 1165 of file task.cc.

◆ QueryTaskEntry()

TaskEntry * TaskGroup::QueryTaskEntry ( int  task_instance) const

Definition at line 1107 of file task.cc.

◆ RunDeferQ()

void TaskGroup::RunDeferQ ( )

Starts executing tasks from deferq_ of a TaskGroup.

Definition at line 1170 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 1189 of file task.cc.

Here is the call graph for this function:

◆ SetDisable()

void TaskGroup::SetDisable ( bool  disable)
inline

Definition at line 283 of file task.cc.

◆ task_id()

int TaskGroup::task_id ( ) const
inline

Definition at line 287 of file task.cc.

◆ TaskExited()

void TaskGroup::TaskExited ( Task t)
inline

Definition at line 1184 of file task.cc.

◆ TaskRunCount()

int TaskGroup::TaskRunCount ( ) const
inline

Definition at line 265 of file task.cc.

◆ TaskStarted()

void TaskGroup::TaskStarted ( )
inline

Definition at line 275 of file task.cc.

Friends And Related Function Documentation

◆ TaskEntry

friend class TaskEntry
friend

Definition at line 301 of file task.cc.

◆ TaskScheduler

friend class TaskScheduler
friend

Definition at line 302 of file task.cc.

Member Data Documentation

◆ deferq_

TaskDeferList TaskGroup::deferq_
private

Tasks deferred till run_count_ is 0.

Definition at line 330 of file task.cc.

◆ disable_

bool TaskGroup::disable_
private

Definition at line 342 of file task.cc.

◆ disable_entry_

TaskEntry* TaskGroup::disable_entry_
private

Task entry for disabled group.

Definition at line 336 of file task.cc.

◆ execute_delay_

uint32_t TaskGroup::execute_delay_
private

Definition at line 340 of file task.cc.

◆ kVectorGrowSize

const int TaskGroup::kVectorGrowSize = 16
staticprivate

Definition at line 316 of file task.cc.

◆ policy_

TaskGroupPolicyList TaskGroup::policy_
private

Policy rules for the group.

Definition at line 327 of file task.cc.

◆ policy_set_

bool TaskGroup::policy_set_
private

Specifies if policy is already set.

Definition at line 320 of file task.cc.

◆ run_count_

int TaskGroup::run_count_
private

No. of tasks running in the group.

Definition at line 323 of file task.cc.

◆ schedule_delay_

uint32_t TaskGroup::schedule_delay_
private

Definition at line 341 of file task.cc.

◆ stats_

TaskStats TaskGroup::stats_
private

Definition at line 344 of file task.cc.

◆ task_code_id_

int TaskGroup::task_code_id_
private

Definition at line 317 of file task.cc.

◆ task_entry_

TaskEntry* TaskGroup::task_entry_
private

Tasks deferred till run_count_ is 0.

Definition at line 333 of file task.cc.

◆ task_entry_db_

TaskEntryList TaskGroup::task_entry_db_
private

task-entries in this group

Definition at line 339 of file task.cc.

◆ total_run_time_

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

Definition at line 324 of file task.cc.


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