COPASI API  4.16.103
Public Types | Public Member Functions | Private Attributes | List of all members
CCopasiTimer Class Reference

#include <CCopasiTimer.h>

Inheritance diagram for CCopasiTimer:
Inheritance graph
[legend]
Collaboration diagram for CCopasiTimer:
Collaboration graph
[legend]

Public Types

enum  Type { WALL = 0, PROCESS, THREAD }
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 

Public Member Functions

 CCopasiTimer (const Type &type=WALL, const CCopasiContainer *pParent=NULL)
 
 CCopasiTimer (const CCopasiTimer &src, const CCopasiContainer *pParent=NULL)
 
const CCopasiTimeVariablegetElapsedTime () const
 
const C_FLOAT64getElapsedTimeSeconds () const
 
virtual voidgetValuePointer () const
 
virtual void print (std::ostream *ostream) const
 
void refresh ()
 
bool start ()
 
 ~CCopasiTimer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const std::string & getKey () const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
virtual std::string getUnits () const
 
UpdateMethodgetUpdateMethod () const
 
virtual const CCopasiObjectgetValueObject () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Private Attributes

CCopasiTimeVariable mElapsedTime
 
C_FLOAT64 mElapsedTimeSeconds
 
CCopasiTimeVariable mStartTime
 
Type mType
 

Additional Inherited Members

- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 24 of file CCopasiTimer.h.

Member Enumeration Documentation

Enumeration of timer types

Enumerator
WALL 
PROCESS 
THREAD 

Definition at line 30 of file CCopasiTimer.h.

Constructor & Destructor Documentation

CCopasiTimer::CCopasiTimer ( const Type type = WALL,
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
constType & type (default: WALL)
constCCopasiContainer * pParent (default: NULL)

Definition at line 24 of file CCopasiTimer.cpp.

References CCopasiTimeVariable::getCurrentWallTime(), CCopasiTimeVariable::getProcessTime(), CCopasiTimeVariable::getThreadTime(), mStartTime, mType, PROCESS, refresh(), CCopasiObject::setRefresh(), THREAD, and WALL.

25  :
26  CCopasiObject((type == CCopasiTimer::WALL) ? "Wall Clock Time" : "CPU Time",
27  pParent, "Timer", CCopasiObject::ValueDbl),
28  mType(type),
29  mStartTime(),
30  mElapsedTime(0),
32 {
33  switch (mType)
34  {
35  case WALL:
37  break;
38 
39  case PROCESS:
41  break;
42 
43  case THREAD:
45  break;
46 
47  }
48 
50 }
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
void setRefresh(CType *pType, void(CType::*method)(void))
static CCopasiTimeVariable getThreadTime()
Definition: CopasiTime.cpp:206
CCopasiTimeVariable mElapsedTime
Definition: CCopasiTimer.h:108
static CCopasiTimeVariable getProcessTime()
Definition: CopasiTime.cpp:180
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
CCopasiTimeVariable mStartTime
Definition: CCopasiTimer.h:103
CCopasiTimer::CCopasiTimer ( const CCopasiTimer src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCCopasiTimer & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 53 of file CCopasiTimer.cpp.

References refresh(), and CCopasiObject::setRefresh().

54  :
55  CCopasiObject(src, pParent),
56  mType(src.mType),
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
void setRefresh(CType *pType, void(CType::*method)(void))
CCopasiTimeVariable mElapsedTime
Definition: CCopasiTimer.h:108
CCopasiTimeVariable mStartTime
Definition: CCopasiTimer.h:103
CCopasiTimer::~CCopasiTimer ( )

Destructor.

Definition at line 62 of file CCopasiTimer.cpp.

63 {}

Member Function Documentation

const CCopasiTimeVariable & CCopasiTimer::getElapsedTime ( ) const

Retrieve the elapsed time.

Returns
const CCopasiTimeVariable & elapsedTime

Definition at line 111 of file CCopasiTimer.cpp.

References mElapsedTime.

Referenced by CFitProblem::printResult(), and COptProblem::printResult().

112 {
113  return mElapsedTime;
114 }
CCopasiTimeVariable mElapsedTime
Definition: CCopasiTimer.h:108
const C_FLOAT64 & CCopasiTimer::getElapsedTimeSeconds ( ) const

Retrieve the elapsed time in seconds.

Returns
const C_FLOAT64 & elapsedTimeSeconds

Definition at line 116 of file CCopasiTimer.cpp.

References mElapsedTimeSeconds.

Referenced by COptProblem::getExecutionTime().

117 {
118  return mElapsedTimeSeconds;
119 }
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
void * CCopasiTimer::getValuePointer ( ) const
virtual

Retrieve a pointer to the value of the object

Reimplemented from CCopasiObject.

Definition at line 124 of file CCopasiTimer.cpp.

References mElapsedTimeSeconds.

125 {return & const_cast<CCopasiTimer *>(this)->mElapsedTimeSeconds;}
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
void CCopasiTimer::print ( std::ostream *  ostream) const
virtual

This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object. To override this default behavior one needs to reimplement the virtual print function.

Parameters
std::ostream* ostream

Reimplemented from CCopasiObject.

Definition at line 121 of file CCopasiTimer.cpp.

References mElapsedTimeSeconds.

122 {(*ostream) << mElapsedTimeSeconds;}
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
void CCopasiTimer::refresh ( )

Actualizes the timer.

Definition at line 88 of file CCopasiTimer.cpp.

References CCopasiTimeVariable::getCurrentWallTime(), CCopasiTimeVariable::getMicroSeconds(), CCopasiTimeVariable::getProcessTime(), CCopasiTimeVariable::getThreadTime(), mElapsedTime, mElapsedTimeSeconds, mStartTime, mType, PROCESS, THREAD, and WALL.

Referenced by CCopasiTimer(), and main().

89 {
90  switch (mType)
91  {
92  case WALL:
94  break;
95 
96  case PROCESS:
98  break;
99 
100  case THREAD:
102  break;
103  }
104 
106  (mElapsedTime.getMicroSeconds() * 1e-6);
107 
108  return;
109 }
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
static CCopasiTimeVariable getThreadTime()
Definition: CopasiTime.cpp:206
CCopasiTimeVariable mElapsedTime
Definition: CCopasiTimer.h:108
static CCopasiTimeVariable getProcessTime()
Definition: CopasiTime.cpp:180
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
CCopasiTimeVariable mStartTime
Definition: CCopasiTimer.h:103
C_INT64 getMicroSeconds(const bool &bounded=false) const
Definition: CopasiTime.cpp:112
bool CCopasiTimer::start ( )

Start or restart the timer.

Returns
bool success

Definition at line 65 of file CCopasiTimer.cpp.

References CCopasiTimeVariable::getCurrentWallTime(), CCopasiTimeVariable::getProcessTime(), CCopasiTimeVariable::getThreadTime(), mElapsedTime, mElapsedTimeSeconds, mStartTime, mType, PROCESS, THREAD, and WALL.

Referenced by COptProblem::initialize().

66 {
67  switch (mType)
68  {
69  case WALL:
71  break;
72 
73  case PROCESS:
75  break;
76 
77  case THREAD:
79  break;
80  }
81 
82  mElapsedTime = 0;
84 
85  return true;
86 }
C_FLOAT64 mElapsedTimeSeconds
Definition: CCopasiTimer.h:113
static CCopasiTimeVariable getThreadTime()
Definition: CopasiTime.cpp:206
CCopasiTimeVariable mElapsedTime
Definition: CCopasiTimer.h:108
static CCopasiTimeVariable getProcessTime()
Definition: CopasiTime.cpp:180
static CCopasiTimeVariable getCurrentWallTime()
Definition: CopasiTime.cpp:160
CCopasiTimeVariable mStartTime
Definition: CCopasiTimer.h:103

Member Data Documentation

CCopasiTimeVariable CCopasiTimer::mElapsedTime
private

The elapsed time of the timer.

Definition at line 108 of file CCopasiTimer.h.

Referenced by getElapsedTime(), refresh(), and start().

C_FLOAT64 CCopasiTimer::mElapsedTimeSeconds
private

The elapsed time as a double used for reporting.

Definition at line 113 of file CCopasiTimer.h.

Referenced by getElapsedTimeSeconds(), getValuePointer(), print(), refresh(), and start().

CCopasiTimeVariable CCopasiTimer::mStartTime
private

The start time of the timer.

Definition at line 103 of file CCopasiTimer.h.

Referenced by CCopasiTimer(), refresh(), and start().

Type CCopasiTimer::mType
private

The timer type

Definition at line 98 of file CCopasiTimer.h.

Referenced by CCopasiTimer(), refresh(), and start().


The documentation for this class was generated from the following files: