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

GlacialTaskAdvocate.cc

Go to the documentation of this file.
00001 /*
00002  * GlacialTaskAdvocate.cc
00003  *
00004  * Copyright (c) 2003, 2004 The University of Utah and the Flux Group.
00005  * All rights reserved.
00006  *
00007  * This file is licensed under the terms of the GNU Public License.  
00008  * See the file "license.terms" for restrictions on redistribution 
00009  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00010  */
00011 
00012 /**
00013  * @file GlacialTaskAdvocate.cc
00014  *
00015  * Implementation of the GlacialTaskAdvocate class.
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 Broker::CPUReserve GlacialTaskAdvocate::PassCPU(Broker::RealTimeTask_ptr rtt,
00032                                                 const Broker::CPUReserve &status,
00033                                                 const Broker::CPUReserve &advice,
00034                                                 const Broker::KeyedReportParameters &krp)
00035     throw (CORBA::SystemException)
00036 {
00037     Broker::CPUReserve new_advice = advice;
00038     CORBA::ULong change;
00039 
00040     if( CORBA::is_nil(this->dm_RemoteObject.in()) )
00041     {
00042         throw CORBA::BAD_INV_ORDER();
00043     }
00044     
00045     if( new_advice.Compute > this->gta_LastAdvice )
00046     {
00047         change = new_advice.Compute - this->gta_LastAdvice;
00048         new_advice.Compute = this->gta_LastAdvice + (change / 4) + 10;
00049     }
00050     else
00051     {
00052         change = this->gta_LastAdvice - new_advice.Compute;
00053         new_advice.Compute = this->gta_LastAdvice - (change / 4);
00054     }
00055     this->gta_LastAdvice = new_advice.Compute;
00056     return this->RealTimeTaskDelegateImpl::PassCPU(rtt,
00057                                                    status,
00058                                                    new_advice,
00059                                                    krp);
00060 }

Generated on Fri Oct 22 07:50:24 2004 for CPU Broker by  doxygen 1.3.9.1