00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _strict_policy_impl_hh
00019 #define _strict_policy_impl_hh
00020
00021 #include "BrokerC.h"
00022 #include "BrokerS.h"
00023
00024 #include "StrictPolicyS.h"
00025
00026 #include "RealTimeSchedule.hh"
00027
00028 #include "listNode.h"
00029
00030
00031
00032
00033 class StrictPolicyImpl : public virtual POA_StrictPolicy
00034 {
00035
00036 public:
00037
00038
00039
00040
00041
00042
00043
00044 StrictPolicyImpl(const char *name);
00045
00046
00047
00048
00049 virtual ~StrictPolicyImpl();
00050
00051
00052 char *Name(void)
00053 throw (CORBA::SystemException);
00054
00055
00056 void AddTask(Broker::Task_ptr task)
00057 throw (CORBA::SystemException);
00058
00059 void RemoveTask(Broker::Task_ptr task)
00060 throw (CORBA::SystemException);
00061
00062
00063 void Activate(const Broker::TaskList &tl)
00064 throw (CORBA::SystemException);
00065
00066 void Deactivate(void)
00067 throw (CORBA::SystemException);
00068
00069
00070 void ChangeTaskCPU(Broker::RealTimeTask_ptr task,
00071 CORBA::ULong ct,
00072 CORBA::ULong status,
00073 CORBA::ULong advice)
00074 throw (CORBA::SystemException, Broker::InvalidState);
00075
00076
00077 Broker::TaskList *GetTaskList(void)
00078 throw (CORBA::SystemException);
00079
00080
00081 void SetTaskPriority(Broker::Task_ptr task, CORBA::Short priority)
00082 throw (CORBA::SystemException);
00083
00084
00085 CORBA::Short GetTaskPriority(Broker::Task_ptr task)
00086 throw (CORBA::SystemException);
00087
00088
00089
00090
00091 const static float MAX_USED_CPU = 0.75;
00092
00093
00094
00095
00096 const static float MIN_TASK_CPU = 0.05;
00097
00098 private:
00099
00100
00101
00102
00103 struct TaskPriority {
00104 struct lnNode tp_Link;
00105 struct TaskPriority *tp_SubLink;
00106 RealTimeSchedule tp_Schedule;
00107 CORBA::ULong tp_SubTime;
00108 Broker::RealTimeTask_var tp_Task;
00109 };
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 struct TaskPriority *FindTaskPriority(Broker::RealTimeTask_ptr task);
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 struct TaskPriority *SubList(const RealTimeSchedule &rts,
00132 struct TaskPriority *ignore);
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 CORBA::ULong TakeCPU(struct TaskPriority *sub_list,
00144 CORBA::ULong amount,
00145 struct TaskPriority *for_tp);
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156 CORBA::ULong GiveCPU(struct TaskPriority *sub_list,
00157 CORBA::ULong amount,
00158 struct TaskPriority *for_tp);
00159
00160
00161 CORBA::String_var sp_Name;
00162
00163 float sp_MaxUsedCPU;
00164
00165 float sp_MinTaskCPU;
00166
00167 struct lnList sp_List;
00168
00169 };
00170
00171 #endif