OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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_node
TaskDeferListOption
 
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_id_
 
bool policy_set_
 Specifies if policy is already set. More...
 
int run_count_
 No. of tasks running in the group. More...
 
tbb::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 222 of file task.cc.

Member Typedef Documentation

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 307 of file task.cc.

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

Definition at line 301 of file task.cc.

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

Vector of Task Group policies.

Definition at line 298 of file task.cc.

Constructor & Destructor Documentation

TaskGroup::TaskGroup ( int  task_id)

Definition at line 1056 of file task.cc.

TaskGroup::~TaskGroup ( )

Definition at line 1065 of file task.cc.

Member Function Documentation

TaskGroup * TaskGroup::ActiveGroupInPolicy ( )

Definition at line 1117 of file task.cc.

void TaskGroup::AddEntriesToDisableQ ( )

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

Definition at line 1188 of file task.cc.

Here is the call graph for this function:

void TaskGroup::AddPolicy ( TaskGroup group)

Definition at line 1113 of file task.cc.

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 1143 of file task.cc.

void TaskGroup::AddToDisableQ ( TaskEntry entry)

Enqueue TaskEntry in disable_entry's deferQ.

Definition at line 1156 of file task.cc.

Here is the call graph for this function:

void TaskGroup::ClearTaskGroupStats ( )

Definition at line 1232 of file task.cc.

void TaskGroup::ClearTaskStats ( )

Definition at line 1236 of file task.cc.

Here is the call graph for this function:

void TaskGroup::ClearTaskStats ( int  instance_id)

Definition at line 1240 of file task.cc.

Here is the call graph for this function:

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

Definition at line 1127 of file task.cc.

Here is the call graph for this function:

size_t TaskGroup::deferq_size ( ) const
inline

Definition at line 281 of file task.cc.

void TaskGroup::DeleteFromDeferQ ( TaskEntry entry)

Delete task from deferq_.

Definition at line 1150 of file task.cc.

TaskGroup::DISALLOW_COPY_AND_ASSIGN ( TaskGroup  )
private
TaskEntry* TaskGroup::GetDisableEntry ( )
inline

Definition at line 242 of file task.cc.

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

Definition at line 1585 of file task.cc.

Here is the call graph for this function:

TaskEntry * TaskGroup::GetTaskEntry ( int  task_instance)

Definition at line 1084 of file task.cc.

TaskStats * TaskGroup::GetTaskGroupStats ( )

Definition at line 1246 of file task.cc.

TaskStats * TaskGroup::GetTaskStats ( )

Definition at line 1250 of file task.cc.

Here is the call graph for this function:

TaskStats * TaskGroup::GetTaskStats ( int  task_instance)

Definition at line 1254 of file task.cc.

Here is the call graph for this function:

void TaskGroup::IncrementTotalRunTime ( int64_t  rtime)
inline

Definition at line 269 of file task.cc.

bool TaskGroup::IsDisabled ( )
inline

Definition at line 277 of file task.cc.

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 1206 of file task.cc.

Here is the call graph for this function:

size_t TaskGroup::num_tasks ( ) const
inline

Definition at line 282 of file task.cc.

void TaskGroup::PolicySet ( )

Definition at line 1160 of file task.cc.

TaskEntry * TaskGroup::QueryTaskEntry ( int  task_instance) const

Definition at line 1102 of file task.cc.

void TaskGroup::RunDeferQ ( )

Starts executing tasks from deferq_ of a TaskGroup.

Definition at line 1165 of file task.cc.

Here is the call graph for this function:

void TaskGroup::RunDisableEntries ( )

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

Definition at line 1184 of file task.cc.

Here is the call graph for this function:

void TaskGroup::SetDisable ( bool  disable)
inline

Definition at line 276 of file task.cc.

int TaskGroup::task_id ( ) const
inline

Definition at line 280 of file task.cc.

void TaskGroup::TaskExited ( Task t)
inline

Definition at line 1179 of file task.cc.

int TaskGroup::TaskRunCount ( ) const
inline

Definition at line 258 of file task.cc.

void TaskGroup::TaskStarted ( )
inline

Definition at line 268 of file task.cc.

Friends And Related Function Documentation

friend class TaskEntry
friend

Definition at line 294 of file task.cc.

friend class TaskScheduler
friend

Definition at line 295 of file task.cc.

Member Data Documentation

TaskDeferList TaskGroup::deferq_
private

Tasks deferred till run_count_ is 0.

Definition at line 323 of file task.cc.

bool TaskGroup::disable_
private

Definition at line 335 of file task.cc.

TaskEntry* TaskGroup::disable_entry_
private

Task entry for disabled group.

Definition at line 329 of file task.cc.

uint32_t TaskGroup::execute_delay_
private

Definition at line 333 of file task.cc.

const int TaskGroup::kVectorGrowSize = 16
staticprivate

Definition at line 309 of file task.cc.

TaskGroupPolicyList TaskGroup::policy_
private

Policy rules for the group.

Definition at line 320 of file task.cc.

bool TaskGroup::policy_set_
private

Specifies if policy is already set.

Definition at line 313 of file task.cc.

int TaskGroup::run_count_
private

No. of tasks running in the group.

Definition at line 316 of file task.cc.

uint32_t TaskGroup::schedule_delay_
private

Definition at line 334 of file task.cc.

TaskStats TaskGroup::stats_
private

Definition at line 337 of file task.cc.

TaskEntry* TaskGroup::task_entry_
private

Tasks deferred till run_count_ is 0.

Definition at line 326 of file task.cc.

TaskEntryList TaskGroup::task_entry_db_
private

task-entries in this group

Definition at line 332 of file task.cc.

int TaskGroup::task_id_
private

Definition at line 310 of file task.cc.

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

Definition at line 317 of file task.cc.


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