Skip to content

Commit b45c104

Browse files
authored
Merge pull request #48 from Roman-Koshelev/master
"First steps towards cross-platform" - This series of commits by Roman-Koshelev abstracts GCC specific attributes to macros and replaces RAMCloud's Atomic.h with the standard implementation.
2 parents f489d8f + 361e4a1 commit b45c104

File tree

12 files changed

+130
-275
lines changed

12 files changed

+130
-275
lines changed

runtime/Atomic.h

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

runtime/Cycles.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <stdint.h>
2020

21+
#include "Portability.h"
2122

2223
namespace PerfUtils {
2324

@@ -34,21 +35,21 @@ class Cycles {
3435
* Return the current value of the fine-grain CPU cycle counter
3536
* (accessed via the RDTSC instruction).
3637
*/
37-
static __inline __attribute__((always_inline))
38+
static NANOLOG_ALWAYS_INLINE
3839
uint64_t
3940
rdtsc()
4041
{
4142
#if TESTING
4243
if (mockTscValue)
4344
return mockTscValue;
4445
#endif
45-
uint32_t lo, hi;
46+
size_t lo, hi;
4647
__asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
4748
// __asm__ __volatile__("rdtscp" : "=a" (lo), "=d" (hi) : : "%rcx");
4849
return (((uint64_t)hi << 32) | lo);
4950
}
5051

51-
static __inline __attribute__((always_inline))
52+
static NANOLOG_ALWAYS_INLINE
5253
double
5354
perSecond(){
5455
return getCyclesPerSec();
@@ -80,7 +81,7 @@ class Cycles {
8081
* Returns the conversion factor between cycles in seconds, using
8182
* a mock value for testing when appropriate.
8283
*/
83-
static __inline __attribute__((always_inline))
84+
static NANOLOG_ALWAYS_INLINE
8485
double
8586
getCyclesPerSec()
8687
{

0 commit comments

Comments
 (0)