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

RKTask.hh

Go to the documentation of this file.
00001 /*
00002  * RKTask.hh
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 RKTask.hh
00014  *
00015  * Header file for the TimeSys implementation of Broker::RealTimeTask.
00016  */
00017 
00018 #ifndef _rktask_impl_hh
00019 #define _rktask_impl_hh
00020 
00021 #include <rk.h>
00022 
00023 #include "BrokerS.h"
00024 
00025 /**
00026  * An implementation of Broker::RealTimeTask for the TimeSys resource kernel.
00027  * The class will create an rk_resource_set for every process on construction
00028  * and maintain it until destruction.
00029  */
00030 class RKTask : public virtual POA_Broker::RealTimeTask
00031 {
00032     
00033 public:
00034 
00035     /**
00036      * Construct an RKTask from the given parameters.  The current set of
00037      * recognized parameters are:
00038      *
00039      * @li @e name A string to be used as the name of the task.  (@e required)
00040      * @li @e pid A long that contains the process ID to manage.  (@e required)
00041      *
00042      * @param tp The list of parameters.
00043      *
00044      * @exception CORBA::SystemException for CORBA related errors.
00045      * @exception Broker::InvalidTaskParameter if one of the parameters is
00046      *            invalid.
00047      * @exception Broker::MissingTaskParameter if one of the required
00048      *            parameters is missing.
00049      */
00050     RKTask(const Broker::TaskParameters &tp)
00051         throw (CORBA::SystemException,
00052                Broker::DuplicateTaskParameter,
00053                Broker::InvalidTaskParameter,
00054                Broker::MissingTaskParameter);
00055 
00056     /**
00057      * Destruct an RKTask.
00058      */
00059     virtual ~RKTask();
00060 
00061     /** @copydoc Broker::Task::Name */
00062     virtual char *Name(void)
00063         throw (CORBA::SystemException);
00064 
00065     /** @copydoc Broker::RealTimeTask::Period */
00066     virtual CORBA::ULong Period(void)
00067         throw (CORBA::SystemException);
00068 
00069     /** @copydoc Broker::RealTimeTask::Deadline */
00070     virtual CORBA::ULong Deadline(void)
00071         throw (CORBA::SystemException);
00072 
00073     /** @copydoc Broker::Task::SetManager */
00074     virtual void SetManager(Broker::Manager_ptr man)
00075         throw (CORBA::SystemException);
00076 
00077     /** @copydoc Broker::Task::BeginCPUScheduling */
00078     virtual void BeginCPUScheduling(const Broker::ScheduleParameters &cs)
00079         throw (CORBA::SystemException,
00080                Broker::DuplicateScheduleParameter,
00081                Broker::InvalidScheduleParameter,
00082                Broker::MissingScheduleParameter);
00083     
00084     /** @copydoc Broker::Task::EndCPUScheduling */
00085     virtual void EndCPUScheduling(void)
00086         throw (CORBA::SystemException);
00087 
00088     /** @copydoc Broker::RealTimeTask::GetComputeTime */
00089     virtual CORBA::ULong GetComputeTime(void)
00090         throw (CORBA::SystemException);
00091     
00092     /** @copydoc Broker::RealTimeTask::SetComputeTime */
00093     virtual void SetComputeTime(CORBA::ULong usecs)
00094         throw (CORBA::SystemException);
00095 
00096     /** @copydoc Broker::RealTimeTask::ReportCPU */
00097     virtual void ReportCPU(Broker::RealTimeTask_ptr rtt,
00098                            CORBA::ULong status,
00099                            CORBA::ULong advice)
00100         throw (CORBA::SystemException);
00101 
00102     /** @copydoc Broker::RealTimeTask::ReportCPU */
00103     virtual void ReportCPU2(CORBA::ULong status,
00104                             CORBA::ULong advice)
00105         throw (CORBA::SystemException)
00106     {
00107         this->ReportCPU(this->_this(), status, advice);
00108     };
00109 
00110 protected:
00111 
00112     /**
00113      * The name of the task and the resource set created for it.
00114      *
00115      * @invariant != NULL
00116      */
00117     CORBA::String_var rkt_Name;
00118 
00119     /**
00120      * The resource set for the process.
00121      */
00122     rk_resource_set_t rkt_ResourceSet;
00123 
00124     /**
00125      * Flag used to indicate whether or not we allocated the resource set.
00126      */
00127     char rkt_OwnsResourceSet;
00128 
00129     /**
00130      * Caches the value of the CPU reservation when scheduling is active and
00131      * maintains the values when not active.
00132      *
00133      * @invariant .compute_time <= .period
00134      * @invariant .deadline <= .period
00135      */
00136     struct cpu_reserve_attr rkt_CPUReserveSpec;
00137     
00138     /**
00139      * The Broker::Manager used to handle scheduling during contention.  Only
00140      * valid between #BeginCPUScheduling and #EndCPUScheduling calls.
00141      */
00142     Broker::Manager_var rkt_Manager;
00143 
00144     /**
00145      * The CPU reserve for the process.  Only valid between #BeginCPUScheduling
00146      * and #EndCPUScheduling calls.
00147      */
00148     rk_reserve_t rkt_CPUReserve;
00149 
00150     /**
00151      * The time of day that this object was constructed.
00152      */
00153     struct timeval rkt_StartTime;
00154 
00155     /**
00156      * The last time a reservation change was logged.
00157      */
00158     struct timeval rkt_LastReservationLog;
00159 
00160     /**
00161      * The output stream for the reservation log file.
00162      */
00163     ofstream *rkt_ReservationLog;
00164     
00165 };
00166 
00167 #endif

Generated on Tue Jun 22 14:50:10 2004 for CPU Broker by doxygen 1.3.6