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

BasicTaskQosketImpl.cc

Go to the documentation of this file.
00001 /*
00002  * BasicTaskQosketImpl.cc
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 BasicTaskQosketImpl.cc
00014  *
00015  * Implementation of the BasicTaskQosketImpl class.
00016  */
00017 
00018 #include "config.h"
00019 
00020 #include <assert_pp.h>
00021 
00022 #include "BasicTaskCallbackImpl.hh"
00023 #include "BasicTaskQosketImpl.hh"
00024 
00025 void BasicTaskQosketImpl::initSysconds(const quo::QuoKernel_ptr &kernel)
00026     throw (CORBA::SystemException)
00027 {
00028     quo::SysCond_var sc;
00029 
00030     require(kernel != NULL);
00031 
00032     /* Get the syscond from the kernel. */
00033     sc = kernel->bindSysCond("DeadlinesMissed",
00034                              "quo::ValueSC",
00035                              "quo_sc::ValueSCImpl");
00036 
00037     this->myDeadlinesMissed =
00038         quo::ValueSC::_duplicate(quo::ValueSC::_narrow(sc.in()));
00039     this->myDeadlinesMissed->longValue(0); /* Set the initial value */
00040     
00041     /* Get the syscond from the kernel. */
00042     sc = kernel->bindSysCond("LastStatus",
00043                              "quo::ValueSC",
00044                              "quo_sc::ValueSCImpl");
00045     
00046     this->myLastStatus =
00047         quo::ValueSC::_duplicate(quo::ValueSC::_narrow(sc.in()));
00048     this->myLastStatus->longValue(0); /* Set the initial value */
00049 }
00050 
00051 void BasicTaskQosketImpl::initCallbacks(const CORBA::ORB_ptr &orb)
00052     throw (CORBA::SystemException)
00053 {
00054     Qosket::Basic::BasicTaskCallback_var btc;
00055     BasicTaskCallbackImpl *btci;
00056 
00057     require(!CORBA::is_nil(orb));
00058 
00059     btci = new BasicTaskCallbackImpl();
00060     btc = btci->_this();
00061     this->myCallback = Qosket::Basic::BasicTaskCallback::_duplicate(btc.in());
00062 }
00063 
00064 quo::ValueSC_ptr BasicTaskQosketImpl::DeadlinesMissed(void)
00065     throw (CORBA::SystemException)
00066 {
00067     quo::ValueSC_var retval;
00068 
00069     retval = this->myDeadlinesMissed;
00070     return( retval._retn() );
00071 }
00072 
00073 quo::ValueSC_ptr BasicTaskQosketImpl::LastStatus(void)
00074     throw (CORBA::SystemException)
00075 {
00076     quo::ValueSC_var retval;
00077 
00078     retval = this->myLastStatus;
00079     return( retval._retn() );
00080 }
00081 
00082 quo::Callback_ptr BasicTaskQosketImpl::Callback(void)
00083     throw (CORBA::SystemException)
00084 {
00085     Qosket::Basic::BasicTaskCallback_var retval;
00086 
00087     retval = this->myCallback;
00088     return( retval._retn() );
00089 }
00090 
00091 CORBA::ULongLong BasicTaskQosketImpl::RUsage(void)
00092     throw (CORBA::SystemException)
00093 {
00094     CORBA::ULongLong retval = 0;
00095     struct rusage ru;
00096 
00097     if( getrusage(RUSAGE_SELF, &ru) == 0 )
00098     {
00099         retval = ru.ru_utime.tv_usec;
00100         retval += ru.ru_utime.tv_sec * 1000000;
00101     }
00102     else
00103     {
00104         throw CORBA::UNKNOWN();
00105     }
00106     return( retval );
00107 }

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