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

RKTask.hh

Go to the documentation of this file.
00001 /*
00002  * RKTask.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 RKTask.hh
00014  *
00015  * Header file for the TimeSys implementation of Broker::RealTimeTask.
00016  */
00017 
00018 #ifndef _task_impl_hh
00019 #define _task_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::BeginCPUScheduling */
00074     virtual void BeginCPUScheduling(Broker::Manager_ptr man,
00075                                     const Broker::ScheduleParameters &cs)
00076         throw (CORBA::SystemException,
00077                Broker::DuplicateScheduleParameter,
00078                Broker::InvalidScheduleParameter,
00079                Broker::MissingScheduleParameter);
00080     
00081     /** @copydoc Broker::Task::EndCPUScheduling */
00082     virtual void EndCPUScheduling(void)
00083         throw (CORBA::SystemException);
00084 
00085     /** @copydoc Broker::RealTimeTask::GetComputeTime */
00086     virtual CORBA::ULong GetComputeTime(void)
00087         throw (CORBA::SystemException);
00088     
00089     /** @copydoc Broker::RealTimeTask::SetComputeTime */
00090     virtual void SetComputeTime(CORBA::ULong usecs)
00091         throw (CORBA::SystemException);
00092 
00093     /** @copydoc Broker::RealTimeTask::ReportCPU */
00094     virtual void ReportCPU(Broker::RealTimeTask_ptr rtt,
00095                            CORBA::ULong status,
00096                            CORBA::ULong advice)
00097         throw (CORBA::SystemException);
00098 
00099 protected:
00100 
00101     /**
00102      * The name of the task and the resource set created for it.
00103      *
00104      * @invariant != NULL
00105      */
00106     CORBA::String_var rkt_Name;
00107 
00108     /**
00109      * The resource set for the process.
00110      *
00111      * @invariant != NULL
00112      */
00113     rk_resource_set_t rkt_ResourceSet;
00114 
00115     /**
00116      * Caches the value of the CPU reservation when scheduling is active and
00117      * maintains the values when not active.
00118      *
00119      * @invariant .compute_time <= .period
00120      * @invariant .deadline <= .period
00121      */
00122     struct cpu_reserve_attr rkt_CPUReserveSpec;
00123     
00124     /**
00125      * The Broker::Manager used to handle scheduling during contention.  Only
00126      * valid between #BeginCPUScheduling and #EndCPUScheduling calls.
00127      */
00128     Broker::Manager_var rkt_Manager;
00129 
00130     /**
00131      * The CPU reserve for the process.  Only valid between #BeginCPUScheduling
00132      * and #EndCPUScheduling calls.
00133      */
00134     rk_reserve_t rkt_CPUReserve;
00135 
00136     /**
00137      * The time of day that this object was constructed.
00138      */
00139     struct timeval rkt_StartTime;
00140 
00141     /**
00142      * The last time a reservation change was logged.
00143      */
00144     struct timeval rkt_LastReservationLog;
00145 
00146     /**
00147      * The output stream for the reservation log file.
00148      */
00149     ofstream *rkt_ReservationLog;
00150     
00151 };
00152 
00153 #endif

Generated on Mon Dec 1 16:29:07 2003 for CPU Broker by doxygen 1.3.4