00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "config.h"
00019
00020 #include "GlacialTaskAdvocate.hh"
00021
00022 GlacialTaskAdvocate::GlacialTaskAdvocate(void)
00023 {
00024 this->gta_LastAdvice = 0;
00025 }
00026
00027 GlacialTaskAdvocate::~GlacialTaskAdvocate(void)
00028 {
00029 }
00030
00031 void GlacialTaskAdvocate::ReportCPU(Broker::RealTimeTask_ptr rtt,
00032 CORBA::ULong status,
00033 CORBA::ULong advice)
00034 throw (CORBA::SystemException)
00035 {
00036 CORBA::ULong change;
00037
00038 if( CORBA::is_nil(this->dm_RemoteObject) )
00039 {
00040 throw CORBA::BAD_INV_ORDER();
00041 }
00042
00043 if( advice > this->gta_LastAdvice )
00044 {
00045 change = advice - this->gta_LastAdvice;
00046 advice = this->gta_LastAdvice + (change / 4) + 10;
00047 }
00048 else
00049 {
00050 change = this->gta_LastAdvice - advice;
00051 advice = this->gta_LastAdvice - (change / 4);
00052 }
00053 this->gta_LastAdvice = advice;
00054 this->RealTimeTaskDelegateImpl::ReportCPU(rtt, status, advice);
00055 }