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

LoggingAdvocate.hh

Go to the documentation of this file.
00001 /*
00002  * LoggingAdvocate.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 LoggingAdvocate.hh
00014  *
00015  * Header file for the LoggingAdvocate class.
00016  */
00017 
00018 #ifndef _logging_advocate_hh
00019 #define _logging_advocate_hh
00020 
00021 #include <iostream>
00022 
00023 #include <RealTimeTaskDelegateImpl.hh>
00024 
00025 /**
00026  * A decorator that logs the status, advice, period completion, and deadline
00027  * hit/misses to individual file.
00028  */
00029 class LoggingAdvocate : public virtual RealTimeTaskDelegateImpl
00030 {
00031 
00032 public:
00033 
00034     /** Default constructor. */
00035     LoggingAdvocate(void);
00036 
00037     /** Destructor. */
00038     virtual ~LoggingAdvocate(void);
00039 
00040     /**
00041      * @copydoc BrokerDelegates::Delegate::SetDelegateAttribute
00042      *
00043      * Currently supported 'id' values are:
00044      *
00045      * @li @e cpu-log The file name where the status value should be logged.
00046      * @li @e advice-log The file name where the advice value should be logged.
00047      * @li @e complete-log The file name where the period completion times
00048      * should be logged.
00049      * @li @e hit-log The file name where period hits should be logged.
00050      * @li @e miss-log The file name where period misses should be logged.
00051      */
00052     virtual void SetDelegateAttribute(const char *id,
00053                                       const CORBA::Any &value)
00054         throw (CORBA::SystemException);
00055     
00056     /**
00057      * @copydoc BrokerDelegates::Delegate::GetDelegateAttribute
00058      *
00059      * Currently supported 'id' values are:
00060      *
00061      * @li @e last-advice The last advice given by the advocate.
00062      */
00063     virtual CORBA::Any *GetDelegateAttribute(const char *id)
00064         throw (CORBA::SystemException);
00065     
00066     /** @copydoc Broker::RealTimeTask::PassCPU */
00067     virtual Broker::CPUReserve  PassCPU(Broker::RealTimeTask_ptr rtt,
00068                                         const Broker::CPUReserve &status,
00069                                         const Broker::CPUReserve &advice,
00070                                         const Broker::KeyedReportParameters &krp)
00071         throw (CORBA::SystemException);
00072 
00073 protected:
00074 
00075     /**
00076      * The length of the last period in microseconds.
00077      */
00078     CORBA::ULong la_LastPeriod;
00079 
00080     /**
00081      * The time that this object was constructed.
00082      */
00083     struct timeval la_StartTime;
00084 
00085     /**
00086      * The last time a log enty was generated.
00087      */
00088     struct timeval la_LastLog;
00089     
00090     /**
00091      * The last time that the CPU usage was logged.
00092      */
00093     struct timeval la_LastCPULog;
00094 
00095     /**
00096      * The output stream for the CPU usage log.
00097      */
00098     ofstream *la_CPULog;
00099 
00100     /**
00101      * The last time the advice was logged.
00102      */
00103     struct timeval la_LastAdviceLog;
00104 
00105     /**
00106      * The output stream for the advice log.
00107      */
00108     ofstream *la_AdviceLog;
00109 
00110     /**
00111      * The output stream for the completion log.
00112      */
00113     ofstream *la_CompleteLog;
00114 
00115     /**
00116      * The output stream for the deadline hit log.
00117      */
00118     ofstream *la_HitLog;
00119 
00120     /**
00121      * The output stream for the deadline miss log.
00122      */
00123     ofstream *la_MissLog;
00124 
00125     /**
00126      * The last advice given by this advocate.
00127      */
00128     CORBA::ULong la_LastAdvice;
00129 
00130 };
00131 
00132 #endif

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