Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WeightedPolicyImpl Class Reference

Collaboration diagram for WeightedPolicyImpl:

Collaboration graph
[legend]
List of all members.

Detailed Description

An implementation of the WeightedPolicy interface.

Definition at line 33 of file WeightedPolicyImpl.hh.

Public Member Functions

 WeightedPolicyImpl (const char *name)
 Construct a WeightedPolicyImpl object with the given values.

virtual ~WeightedPolicyImpl ()
 Deconstruct the policy.

virtual char * Name (void) throw (CORBA::SystemException)
 Mostly useful for debugging.

virtual void AddTask (Broker::Task_ptr new_task, const Broker::ScheduleParameters &sp) throw (CORBA::SystemException, Broker::DuplicateScheduleParameter, Broker::InvalidScheduleParameter, Broker::MissingScheduleParameter)
 NOTE: This method will be called before the reservation is made, giving the policy a chance to adjust any values.

See also:
RemoveTask
Parameters:
new_task The newly created Task object.
sp The tasks's scheduling parameters.
Exceptions:
CORBA::BAD_PARAM if task is nil.
CORBA::BAD_PARAM if task has already been added.
CORBA::BAD_INV_ORDER if the method is called without Activate() being called first.


virtual void RemoveTask (Broker::Task_ptr added_task) throw (CORBA::SystemException)
 NOTE: This method will be called after the reservation has been destroyed, so it can safely reallocate the newly freed CPU time.

See also:
AddTask
Parameters:
added_task The task to remove.
Exceptions:
CORBA::BAD_PARAM if task is nil.
CORBA::BAD_PARAM if task has already been removed.
CORBA::BAD_INV_ORDER if the method is called without Activate() being called first.


virtual Broker::TaskListGetTaskList (void) throw (CORBA::SystemException)
 
Returns:
The list of task's managed by this policy.


virtual void Activate (const Broker::TaskList &tasks) throw (CORBA::SystemException)
 NOTE: The policy is expected to discover and adjust the scheduling parameters of any currently executing tasks.

See also:
Deactivate
Parameters:
tasks The list of tasks the policy needs to manage.
Exceptions:
CORBA::BAD_INV_ORDER if the method is called without intervening calls to Deactivate().


virtual void Deactivate (void) throw (CORBA::SystemException)
 NOTE: The policy should change any scheduling parameters of the currently executing tasks, the next policy to be activated will handle any changes.

See also:
Deactivate
Exceptions:
CORBA::BAD_INV_ORDER if the method is called on an inactive policy.


virtual Broker::CPUReserve ChangeTaskCPU (Broker::RealTimeTask_ptr task, const Broker::CPUReserve &advice) throw (CORBA::SystemException, Broker::InvalidState)
 
Parameters:
task The Task object requesting a CPU time change.
advice The CPU time advice from the Task object.
Returns:
The actual CPU reserve given to the task.


virtual CORBA::Float GetMaxCPUAllocation (void) throw (CORBA::SystemException)
 
Returns:
The maximum percentage of CPU that can be allocated to all of the tasks.


virtual void SetMaxCPUAllocation (CORBA::Float amount) throw (CORBA::SystemException)
 
Parameters:
amount The maximum percentage of CPU that can be allocated to all of the tasks.


virtual void SetTaskWeight (Broker::Task_ptr task, CORBA::UShort weight) throw (CORBA::SystemException)
 
Parameters:
task The task whose priority should be changed.
weight The new weight.
Exceptions:
CORBA::BAD_PARAM if task is nil.
CORBA::BAD_PARAM if task is not managed by this policy.


virtual CORBA::UShort GetTaskWeight (Broker::Task_ptr task) throw (CORBA::SystemException)
 
Parameters:
task The task whose weight should be retrieved.
Returns:
The task's weight.
Exceptions:
CORBA::BAD_PARAM if task is nil.
CORBA::BAD_PARAM if task is not managed by this policy.



Static Public Attributes

const float DEFAULT_MAX_USED_CPU = 0.75
 Maximum percentage of CPU to allocate to tasks.

const float DEFAULT_MIN_TASK_CPU = 0.02
 Minimum percentage of CPU to allocate to a single task.


Private Member Functions

void RepairTaskList (void)
 Repair the task list by removing any dead/unreachable objects.

TaskDataFindTaskData (Broker::RealTimeTask_ptr task)
 Find the TaskData node that corresponds to the given task.

void RedistributeCPU (void)
 Redistribute CPU to any tasks managed by this policy.


Private Attributes

CORBA::String_var wp_Name
 The name of this object as registered with the NamingService.

float wp_MaxUsedCPU
 The maximum percentage of CPU time that we are allowed to allocate.

float wp_MinTaskCPU
 The minimum percentage of CPU time that a task must have.

lnList wp_List
 A list of TaskData objects.

CORBA::ULong wp_MaxDeadline
 The largest deadline of the tasks managed by this policy.

unsigned long long wp_TotalWeightedComputeTime
 Cached value for the weighted compute time of all the tasks.


Constructor & Destructor Documentation

WeightedPolicyImpl::WeightedPolicyImpl const char *  name  ) 
 

Construct a WeightedPolicyImpl object with the given values.

Parameters:
name The name of this object as registered with the NamingService.

Definition at line 29 of file WeightedPolicyImpl.cc.

References lnNewList(), require, wp_MaxUsedCPU, wp_MinTaskCPU, and wp_TotalWeightedComputeTime.

Here is the call graph for this function:


Member Function Documentation

void WeightedPolicyImpl::Activate const Broker::TaskList tasks  )  throw (CORBA::SystemException) [virtual]
 

NOTE: The policy is expected to discover and adjust the scheduling parameters of any currently executing tasks.

See also:
Deactivate
Parameters:
tasks The list of tasks the policy needs to manage.
Exceptions:
CORBA::BAD_INV_ORDER if the method is called without intervening calls to Deactivate().

Todo:
implement

Definition at line 183 of file WeightedPolicyImpl.cc.

References Broker::TaskList.

void WeightedPolicyImpl::Deactivate void   )  throw (CORBA::SystemException) [virtual]
 

NOTE: The policy should change any scheduling parameters of the currently executing tasks, the next policy to be activated will handle any changes.

See also:
Deactivate
Exceptions:
CORBA::BAD_INV_ORDER if the method is called on an inactive policy.

Todo:
implement

Definition at line 189 of file WeightedPolicyImpl.cc.

struct WeightedPolicyImpl::TaskData * WeightedPolicyImpl::FindTaskData Broker::RealTimeTask_ptr  task  )  [private]
 

Find the TaskData node that corresponds to the given task.

Parameters:
task The Broker::RealTimeTask object to look up.
Returns:
The TaskData list node that has the given task object.
Exceptions:
Broker::Internal If no TaskData node exists for the given task.

Definition at line 405 of file WeightedPolicyImpl.cc.

References lnList::lh_Head, lnNode::ln_Succ, require, and wp_List.


The documentation for this class was generated from the following files:
Generated on Tue Jun 22 14:52:06 2004 for CPU Broker by doxygen 1.3.6