00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00048 #ifndef WINSTL_INCL_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER
00049 #define WINSTL_INCL_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define WINSTL_VER_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER_MAJOR 4
00053 # define WINSTL_VER_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER_MINOR 0
00054 # define WINSTL_VER_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER_REVISION 3
00055 # define WINSTL_VER_WINSTL_PERFORMANCE_HPP_MULTIMEDIA_COUNTER_EDIT 42
00056 #endif
00057
00058
00059
00060
00061
00062 #ifndef WINSTL_INCL_WINSTL_H_WINSTL
00063 # include <winstl/winstl.h>
00064 #endif
00065
00066 #ifndef STLSOFT_INCL_H_MMSYSTEM
00067 # define STLSOFT_INCL_H_MMSYSTEM
00068 # include <mmsystem.h>
00069 #endif
00070
00071
00072
00073
00074
00075 #ifndef _WINSTL_NO_NAMESPACE
00076 # if defined(_STLSOFT_NO_NAMESPACE) || \
00077 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00078
00079 namespace winstl
00080 {
00081 # else
00082
00083
00084 namespace stlsoft
00085 {
00086
00087 namespace winstl_project
00088 {
00089
00090 # endif
00091 #endif
00092
00093
00094
00095
00096
00097
00105 class multimedia_counter
00106 {
00107 public:
00109 typedef multimedia_counter class_type;
00110
00111 private:
00112 typedef ws_sint64_t epoch_type;
00113 public:
00117 typedef ws_sint64_t interval_type;
00118
00119
00120 public:
00121 multimedia_counter();
00122
00123
00124 public:
00128 void start();
00132 void stop();
00133
00134
00135 public:
00139 interval_type get_period_count() const;
00143 interval_type get_seconds() const;
00147 interval_type get_milliseconds() const;
00151 interval_type get_microseconds() const;
00152
00153
00154 private:
00155 ws_dword_t m_start;
00156 ws_dword_t m_end;
00157 };
00158
00160
00161
00162 #ifdef STLSOFT_UNITTEST
00163 # include "./unittest/multimedia_counter_unittest_.h"
00164 #endif
00165
00167
00168
00169 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00170
00171 inline multimedia_counter::multimedia_counter()
00172 {
00173
00174
00175
00176 }
00177
00178
00179 inline void multimedia_counter::start()
00180 {
00181 m_start = ::timeGetTime();
00182 }
00183
00184 inline void multimedia_counter::stop()
00185 {
00186 m_end = ::timeGetTime();
00187 }
00188
00189
00190 inline multimedia_counter::interval_type multimedia_counter::get_period_count() const
00191 {
00192 return static_cast<interval_type>(m_end - m_start);
00193 }
00194
00195 inline multimedia_counter::interval_type multimedia_counter::get_seconds() const
00196 {
00197 return get_period_count() / interval_type(1000);
00198 }
00199
00200 inline multimedia_counter::interval_type multimedia_counter::get_milliseconds() const
00201 {
00202 return get_period_count();
00203 }
00204
00205 inline multimedia_counter::interval_type multimedia_counter::get_microseconds() const
00206 {
00207 return get_period_count() * interval_type(1000);
00208 }
00209
00210 #endif
00211
00212
00213
00214 #ifndef _WINSTL_NO_NAMESPACE
00215 # if defined(_STLSOFT_NO_NAMESPACE) || \
00216 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00217 }
00218 # else
00219 }
00220 }
00221 # endif
00222 #endif
00223
00224
00225
00226 #endif
00227
00228