summaryrefslogtreecommitdiffstats
path: root/src/os_time.cpp
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2016-05-11 17:03:17 +0300
committerHanoh Haim <hhaim@cisco.com>2016-05-11 17:03:17 +0300
commitfa7a837fb19af1c1fe4365de3f71467b79c2c865 (patch)
tree2407b27bcfb2123b3a849745a5d0b925ca8b41c1 /src/os_time.cpp
parent5fe90f4366284608c00c59fab4a2cf19c8058c2e (diff)
another minor optimization - better for low cpu%
Diffstat (limited to 'src/os_time.cpp')
-rwxr-xr-xsrc/os_time.cpp64
1 files changed, 2 insertions, 62 deletions
diff --git a/src/os_time.cpp b/src/os_time.cpp
index 706ab4d8..1854749d 100755
--- a/src/os_time.cpp
+++ b/src/os_time.cpp
@@ -22,69 +22,9 @@ limitations under the License.
#include "os_time.h"
#include <stdio.h>
-hr_time_t start_time;
-#ifdef WIN32
+COsTimeGlobalData timer_gd;
-#include <windows.h>
-uint32_t os_get_time_msec(){
- return (GetTickCount());
-}
-uint32_t os_get_time_freq(){
- return (1000);
-}
-
-
-typedef union {
- struct {
- uint32_t low;
- uint32_t high;
- } h;
- hr_time_t x;
-} timer_hl_t;
-
-//hr_time_t os_get_hr_freq(void);
-
-hr_time_t os_get_hr_freq(void){
- return (3000000000);
-}
-
-
-hr_time_t os_get_hr_tick_64(void) {
- uint32_t _low,_high;
- __asm {
- mov ecx,0 ;select Counter0
-
- _emit 0x0F ;RDPMC - get beginning value of Counter0 to edx:eax
- _emit 0x31
-
- mov _high,edx ;save beginning value
- mov _low,eax
- }
-
- timer_hl_t x;
-
- x.h.low = _low;
- x.h.high = _high;
-
- return x.x;
-}
-
-uint32_t os_get_hr_tick_32(void) {
- uint32_t _low,_high;
- __asm {
- mov ecx,0 ;select Counter0
-
- _emit 0x0F ;RDPMC - get beginning value of Counter0 to edx:eax
- _emit 0x31
-
- mov _high,edx ;save beginning value
- mov _low,eax
- }
- return _low;
-}
-
-#else
#include <time.h>
@@ -120,6 +60,6 @@ uint32_t os_get_time_freq(){
-#endif
+