Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 // -*- c++ -*-
     19 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
     20 
     21 //               O S C L _ T I C K C O U N T
     22 
     23 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
     24 
     25 /*! \addtogroup osclutil OSCL Util
     26  *
     27  * @{
     28  */
     29 
     30 
     31 /** \file oscl_tickcount.h
     32     \brief Defines a data structure for string containment/manipulations where the storage for the string is maintained externally.
     33 */
     34 
     35 #ifndef OSCL_TICKCOUNT_H_INCLUDED
     36 #define OSCL_TICKCOUNT_H_INCLUDED
     37 
     38 #ifndef OSCL_BASE_H_INCLUDED
     39 #include "oscl_base.h"
     40 #endif
     41 
     42 #define OSCLTICKCOUNT_MAX_TICKS 0xffffffff
     43 
     44 /**
     45  * OsclTickCount class is used to retrieve the system tick
     46  * count and the tick counter's frequency.
     47  *
     48  * The maximum tick count value is equivalent to the maximum
     49  * uint32 value.
     50  */
     51 class OsclTickCount
     52 {
     53     public:
     54         /**
     55          * This function returns the current system tick count
     56          *
     57          * @return returns the tick count
     58          */
     59         static uint32 TickCount();
     60 
     61         /**
     62          * This function returns the tick frequency in ticks
     63          * per second
     64          *
     65          * @return ticks per second
     66          */
     67         static uint32 TickCountFrequency();
     68 
     69         /**
     70          * This function returns the tick period in
     71          * microseconds per tick
     72          *
     73          * @return microseconds per tick
     74          */
     75         static uint32 TickCountPeriod();
     76 
     77         /**
     78          * This function converts ticks to milliseconds
     79          *
     80          * @return milliseconds
     81          */
     82         static uint32 TicksToMsec(uint32 ticks);
     83 
     84         /**
     85          * This function converts milliseconds to ticks
     86          *
     87          * @return ticks
     88          */
     89         static uint32 MsecToTicks(uint32 msec);
     90 };
     91 
     92 #if !OSCL_DISABLE_INLINES
     93 #include "oscl_tickcount.inl"
     94 #endif
     95 
     96 #endif // OSCL_TICK_UTILS_H_INCLUDED
     97 
     98 /*! @} */
     99