00001 /* 00002 * MaxDecayTaskAdvocate.hh 00003 * 00004 * Copyright (c) 2003 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 MaxDecayTaskAdvocate.hh 00014 * 00015 * Header file for the MaxDecayTaskAdvocate class. 00016 */ 00017 00018 #ifndef _max_decay_task_advocate_hh 00019 #define _max_decay_task_advocate_hh 00020 00021 #include <RealTimeTaskDelegateImpl.hh> 00022 00023 /** 00024 * An ExactTaskAdvocate that will always advise the maximum required processing 00025 * time it has ever seen. 00026 */ 00027 class MaxDecayTaskAdvocate : public virtual RealTimeTaskDelegateImpl 00028 { 00029 00030 public: 00031 00032 MaxDecayTaskAdvocate(void); 00033 00034 virtual ~MaxDecayTaskAdvocate(void); 00035 00036 /** 00037 * Compute a new processing time advice from the given status value. The 00038 * max implementation will compare the advice reported by the parent class 00039 * against the current processing time and return the maximum of the two. 00040 * 00041 * @param rtt The task object that was actually added to the manager. 00042 * @param status The CPU usage of the task in microseconds. 00043 * @param advice The amount of CPU time, in microseconds, that the 00044 * application would like for the next period. 00045 * @return A processing time that will satisfy all requirements that have 00046 * been encountered so far. 00047 * @exception CORBA::BAD_INV_ORDER if the method is called without 00048 * BeginCPUScheduling() being called first. 00049 */ 00050 virtual void ReportCPU(Broker::RealTimeTask_ptr rtt, 00051 CORBA::ULong status, 00052 CORBA::ULong advice) 00053 throw (CORBA::SystemException); 00054 00055 private: 00056 00057 /** 00058 * The last advice reported by this advocate. 00059 */ 00060 CORBA::ULong md_LastAdvice; 00061 00062 /** 00063 * The maximum observed usage that is still below the last advice given. 00064 */ 00065 CORBA::ULong md_SubMax; 00066 00067 /** 00068 * The number of periods left before the reservation will be dropped to the 00069 * value of md_SubMax. 00070 */ 00071 unsigned int md_Decay; 00072 00073 }; 00074 00075 #endif