Skip to content

Commit cb3ddd7

Browse files
authored
use standard timers and record chrome tracing start time (#127)
* switch timers to use std::chrono add a metadata event for start time to chrome tracing * switch from system_clock to steady_clock * delete OS timer files since they are no longer needed
1 parent 0cf242e commit cb3ddd7

File tree

7 files changed

+84
-251
lines changed

7 files changed

+84
-251
lines changed

intercept/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ source_group(CL FILES
3030

3131
set(CLINTERCEPT_OS_FILES
3232
OS/OS.h
33-
OS/OS_timer.h
3433
)
3534
if(WIN32)
3635
list(APPEND CLINTERCEPT_OS_FILES

intercept/OS/OS_linux_common.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#pragma once
2424

25-
#include "OS_timer.h"
26-
2725
#include <sys/stat.h>
2826
#include <dlfcn.h>
2927
#include <pthread.h>
@@ -87,10 +85,6 @@ class Services_Common
8785
void OutputDebugString(
8886
const std::string& str ) const;
8987

90-
uint64_t GetTimer() const;
91-
uint64_t TickToNS(
92-
uint64_t delta ) const;
93-
9488
void* LoadLibrary(
9589
const std::string& libraryName ) const;
9690
void UnloadLibrary(
@@ -113,8 +107,6 @@ class Services_Common
113107
const std::string& fileName ) const;
114108

115109
private:
116-
Timer m_Timer;
117-
118110
bool GetControlFromFile(
119111
const std::string& fileName,
120112
const std::string& controlName,
@@ -171,17 +163,6 @@ inline void Services_Common::OutputDebugString(
171163
syslog( LOG_USER | LOG_INFO, "%s", str.c_str() );
172164
}
173165

174-
inline uint64_t Services_Common::GetTimer() const
175-
{
176-
return m_Timer.GetTimer();
177-
}
178-
179-
inline uint64_t Services_Common::TickToNS(
180-
uint64_t delta ) const
181-
{
182-
return m_Timer.TickToNS( delta );
183-
}
184-
185166
inline void* Services_Common::LoadLibrary(
186167
const std::string& libraryName ) const
187168
{

intercept/OS/OS_mac_common.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ class Services_Common
8383
void OutputDebugString(
8484
const std::string& str ) const;
8585

86-
uint64_t GetTimer() const;
87-
uint64_t TickToNS(
88-
uint64_t delta ) const;
89-
9086
void* LoadLibrary(
9187
const std::string& libraryName ) const;
9288
void UnloadLibrary(
@@ -161,20 +157,6 @@ inline void Services_Common::OutputDebugString(
161157
syslog( LOG_USER | LOG_INFO, "%s", str.c_str() );
162158
}
163159

164-
inline uint64_t Services_Common::GetTimer() const
165-
{
166-
timeval i;
167-
gettimeofday( &i, NULL );
168-
return i.tv_sec * 1000000 + i.tv_usec;
169-
}
170-
171-
inline uint64_t Services_Common::TickToNS(
172-
uint64_t delta ) const
173-
{
174-
double ns = delta * 1000.0;
175-
return (uint64_t)ns;
176-
}
177-
178160
inline void* Services_Common::LoadLibrary(
179161
const std::string& libraryName ) const
180162
{

intercept/OS/OS_timer.h

Lines changed: 0 additions & 121 deletions
This file was deleted.

intercept/OS/OS_windows_common.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
#pragma once
2424

25-
#include "OS_timer.h"
26-
2725
#include <Windows.h>
2826
#include <string>
2927

@@ -78,10 +76,6 @@ class Services_Common
7876
void OutputDebugString(
7977
const std::string& str ) const;
8078

81-
uint64_t GetTimer() const;
82-
uint64_t TickToNS(
83-
uint64_t delta ) const;
84-
8579
void* LoadLibrary(
8680
const std::string& libraryName ) const;
8781
void UnloadLibrary(
@@ -104,18 +98,11 @@ class Services_Common
10498
const std::string& fileName ) const;
10599

106100
private:
107-
Timer m_Timer;
108-
109101
DISALLOW_COPY_AND_ASSIGN( Services_Common );
110102
};
111103

112104
inline bool Services_Common::Init()
113105
{
114-
if( m_Timer.Init() == false )
115-
{
116-
return false;
117-
}
118-
119106
return true;
120107
}
121108

@@ -245,17 +232,6 @@ inline void Services_Common::OutputDebugString(
245232
::OutputDebugString( str.c_str() );
246233
}
247234

248-
inline uint64_t Services_Common::GetTimer() const
249-
{
250-
return m_Timer.GetTimer();
251-
}
252-
253-
inline uint64_t Services_Common::TickToNS(
254-
uint64_t delta ) const
255-
{
256-
return m_Timer.TickToNS( delta );
257-
}
258-
259235
inline void* Services_Common::LoadLibrary(
260236
const std::string& libraryName ) const
261237
{

0 commit comments

Comments
 (0)