oaTimer.h

Go to the documentation of this file.
00001 // ****************************************************************************
00002 // ****************************************************************************
00003 // oaTimer.h
00004 //
00005 // This file contains classes which have to do with measuring or recording
00006 // time..
00007 //
00008 // oaTimer
00009 //     This is a utility class that can be used to time how long a section of
00010 // code takes to execute. Elapsed and cpu times are recorded together.
00011 //
00012 // oaSystemTime
00013 //     This is a utility class which implements a time object. This is stored
00014 // by year, month, day, hour, minute, and second.
00015 //
00016 // ****************************************************************************
00017 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00018 // Integration Initiative, this material may not be copied, modified,
00019 // re-published, uploaded, executed, or distributed in any way, in any medium,
00020 // in whole or in part, without prior written permission from Cadence.
00021 //
00022 //                Copyright 2002-2008 Cadence Design Systems, Inc.
00023 //                           All Rights Reserved.
00024 //
00025 //  $Author: icftcm $
00026 //  $Revision: #1 $
00027 //  $Date: 2010/08/09 $
00028 //  $State: Exp $
00029 // ****************************************************************************
00030 // ****************************************************************************
00031 
00032 
00033 
00034 #if !defined(oaTimer_P)
00035 #define oaTimer_P
00036 
00037 
00038 
00039 // *****************************************************************************
00040 // Nested includes
00041 // *****************************************************************************
00042 #include "oaBaseTypes.h"
00043 
00044 
00045 
00046 // *****************************************************************************
00047 // Declare and define types in the OpenAccess namespace.
00048 // *****************************************************************************
00049 BEGIN_OA_NAMESPACE
00050 
00051 
00052 
00053 // ****************************************************************************
00054 // oaTimer
00055 // ****************************************************************************
00056 class OA_BASE_DLL_API oaTimer {
00057 public:
00058                             oaTimer();
00059 
00060     void                    reset();
00061 
00062 #if !defined(OA_DEPRECATED)
00063     oaFloat                 getElapsed();
00064 #endif
00065     oaFloat                 getElapsed() const;
00066 
00067 private:
00068     static oaFloat          calcScale();
00069 
00070 #if defined(OA_WINDOWS)
00071     __int64                 start;
00072 #else
00073     clock_t                 start;
00074 #endif
00075 
00076     static const oaFloat    scale;
00077 };
00078 
00079 
00080 
00081 // ****************************************************************************
00082 // oaSystemTime
00083 // ****************************************************************************
00084 class OA_BASE_DLL_API oaSystemTime {
00085 public:
00086                             oaSystemTime();
00087     void                    getCurrentTime();
00088 
00089     oaUInt4                 getYear() const;
00090     oaUInt4                 getMonth() const;
00091     oaUInt4                 getDay() const;
00092     oaUInt4                 getHour() const;
00093     oaUInt4                 getMinute() const;
00094     oaUInt4                 getSecond() const;
00095 
00096 private:
00097     oaUInt4                 year;
00098     oaUInt4                 month;
00099     oaUInt4                 day;
00100     oaUInt4                 hour;
00101     oaUInt4                 minute;
00102     oaUInt4                 second;
00103 };
00104 
00105 
00106 
00107 END_OA_NAMESPACE
00108 
00109 #endif

Return to top of page