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

RKObserverAdvocate.hh

Go to the documentation of this file.
00001 /*
00002  * RKObserverAdvocate.hh
00003  *
00004  * Copyright (c) 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 RKObserverAdvocate.hh
00014  *
00015  * Header file for the RKObserverAdvocate class.
00016  */
00017 
00018 #ifndef _rk_observer_advocate_hh
00019 #define _rk_observer_advocate_hh
00020 
00021 #include <rk.h>
00022 #include <pthread.h>
00023 #include <RealTimeTaskDelegateImpl.hh>
00024 
00025 /**
00026  * An advocate that periodically polls an RK resource set and automatically
00027  * sends a report with the usage observed over the last period.
00028  */
00029 class RKObserverAdvocate : public virtual RealTimeTaskDelegateImpl
00030 {
00031 
00032 public:
00033 
00034     /**
00035      * Construct the advocate.
00036      */
00037     RKObserverAdvocate(void)
00038         throw (CORBA::SystemException);
00039 
00040     /**
00041      * Deconstruct the advocate.
00042      */
00043     virtual ~RKObserverAdvocate(void);
00044 
00045     /** @copydoc Broker::Task::BeginCPUScheduling */
00046     virtual void BeginCPUScheduling(const Broker::ScheduleParameters &sp)
00047         throw (CORBA::SystemException,
00048                Broker::DuplicateScheduleParameter,
00049                Broker::InvalidScheduleParameter,
00050                Broker::MissingScheduleParameter);
00051     
00052     /** @copydoc Broker::Task::EndCPUScheduling */
00053     virtual void EndCPUScheduling(void)
00054         throw (CORBA::SystemException);
00055 
00056     /**
00057      * The main polling loop.
00058      */
00059     virtual void run(void);
00060     
00061 private:
00062 
00063     /**
00064      * A cached reference to this CORBA object.
00065      */
00066     Broker::RealTimeTask_var rkoa_Advocate;
00067 
00068     /**
00069      * Mutex used to serialize access to this object.
00070      */
00071     pthread_mutex_t rkoa_Mutex;
00072 
00073     /**
00074      * Condition variable used to block/unblock the polling loop.
00075      */
00076     pthread_cond_t rkoa_Cond;
00077 
00078     /**
00079      * Reference to the polling thread.
00080      */
00081     pthread_t rkoa_Thread;
00082 
00083     /**
00084      * The task's period in a convenient form.
00085      */
00086     struct timespec rkoa_Period;
00087 
00088     /**
00089      * The resource set being monitored.
00090      */
00091     volatile rk_resource_set_t rkoa_ResourceSet;
00092 
00093 };
00094 
00095 #endif

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