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

GCTaskAdvocate.hh

Go to the documentation of this file.
00001 /*
00002  * GCTaskAdvocate.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 GCTaskAdvocate.hh
00014  *
00015  * Header file for the GCTaskAdvocate class.
00016  */
00017 
00018 #ifndef _gc_task_advocate_hh
00019 #define _gc_task_advocate_hh
00020 
00021 #include "ExactTaskAdvocate.hh"
00022 
00023 class GCInterval
00024 {
00025 public:
00026 
00027     static const int TOLERANCE = 500;
00028     
00029     CORBA::ULong i_Compute;
00030     unsigned int i_Length;
00031 
00032     int match(CORBA::ULong ct)
00033     {
00034         int retval = 0;
00035         
00036         if( (ct > (this->i_Compute - TOLERANCE)) &&
00037             (ct < (this->i_Compute + TOLERANCE)) )
00038         {
00039             retval = 0;
00040         }
00041         return( retval );
00042     };
00043 };
00044     
00045 /**
00046  * An ExactTaskAdvocate that will always advise the gcimum required processing
00047  * time it has ever seen.
00048  */
00049 class GCTaskAdvocate : public ExactTaskAdvocate
00050 {
00051 
00052 public:
00053     
00054     /** @copydoc Broker::TaskFactory::CreateTask */
00055     GCTaskAdvocate(const Broker::TaskParameters &tp)
00056         throw (CORBA::SystemException,
00057                Broker::DuplicateTaskParameter,
00058                Broker::InvalidTaskParameter,
00059                Broker::MissingTaskParameter);
00060     
00061     /**
00062      * Compute a new processing time advice from the given status value.  The
00063      * gc implementation will compare the advice reported by the parent class
00064      * against the current processing time and return the gcimum of the two.
00065      *
00066      * @param status The value passed into ReportCPU.
00067      * @return A processing time that will satisfy all requirements that have
00068      *         been encountered so far.
00069      * @exception InvalidStatus if the status value is invalid.
00070      * @exception CORBA::BAD_INV_ORDER if the method is called without
00071      *            BeginCPUScheduling() being called first.
00072      */
00073     virtual CORBA::ULong ComputeAdvice(CORBA::ULong status)
00074         throw (CORBA::SystemException, Broker::InvalidStatus);
00075 
00076 protected:
00077 
00078     typedef enum {
00079         DETECT_MODE_OFF,
00080         DETECT_MODE_ON,
00081     } detect_mode_t;
00082 
00083     detect_mode_t gta_Mode;
00084     GCInterval gta_Intervals[16];
00085     unsigned int gta_Index;
00086     unsigned int gta_Length;
00087     unsigned int gta_PeriodIndex;
00088 
00089 };
00090 
00091 #endif

Generated on Mon Dec 1 16:21:56 2003 for CPUBroker by doxygen 1.3.4