Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[XRay] [compiler-rt] Move machine-dependent code into machine-depende…
…nt files. Summary: Include the necessary headers while there. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25360 llvm-svn: 290077
- Loading branch information
1 parent
8f687f7
commit 094173b
Showing
7 changed files
with
176 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#pragma once | ||
#include <time.h> | ||
|
||
#include "sanitizer_common/sanitizer_internal_defs.h" | ||
#include "xray_defs.h" | ||
|
||
namespace __xray { | ||
|
||
static constexpr uint64_t NanosecondsPerSecond = 1000ULL * 1000 * 1000; | ||
|
||
ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT { | ||
timespec TS; | ||
int result = clock_gettime(CLOCK_REALTIME, &TS); | ||
if (result != 0) { | ||
Report("clock_gettime(2) returned %d, errno=%d.", result, int(errno)); | ||
TS.tv_sec = 0; | ||
TS.tv_nsec = 0; | ||
} | ||
CPU = 0; | ||
return TS.tv_sec * NanosecondsPerSecond + TS.tv_nsec; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
#include <x86intrin.h> | ||
|
||
#include "sanitizer_common/sanitizer_internal_defs.h" | ||
#include "xray_defs.h" | ||
|
||
namespace __xray { | ||
|
||
ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT { | ||
unsigned LongCPU; | ||
uint64_t TSC = __rdtscp(&LongCPU); | ||
CPU = LongCPU; | ||
return TSC; | ||
} | ||
|
||
} |