Skip to content

Commit

Permalink
Merge pull request #48 from Roman-Koshelev/master
Browse files Browse the repository at this point in the history
"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.
  • Loading branch information
syang0 committed Nov 23, 2020
2 parents f489d8f + 361e4a1 commit b45c104
Show file tree
Hide file tree
Showing 12 changed files with 130 additions and 275 deletions.
226 changes: 0 additions & 226 deletions runtime/Atomic.h

This file was deleted.

9 changes: 5 additions & 4 deletions runtime/Cycles.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <stdint.h>

#include "Portability.h"

namespace PerfUtils {

Expand All @@ -34,21 +35,21 @@ class Cycles {
* Return the current value of the fine-grain CPU cycle counter
* (accessed via the RDTSC instruction).
*/
static __inline __attribute__((always_inline))
static NANOLOG_ALWAYS_INLINE
uint64_t
rdtsc()
{
#if TESTING
if (mockTscValue)
return mockTscValue;
#endif
uint32_t lo, hi;
size_t lo, hi;
__asm__ __volatile__("rdtsc" : "=a" (lo), "=d" (hi));
// __asm__ __volatile__("rdtscp" : "=a" (lo), "=d" (hi) : : "%rcx");
return (((uint64_t)hi << 32) | lo);
}

static __inline __attribute__((always_inline))
static NANOLOG_ALWAYS_INLINE
double
perSecond(){
return getCyclesPerSec();
Expand Down Expand Up @@ -80,7 +81,7 @@ class Cycles {
* Returns the conversion factor between cycles in seconds, using
* a mock value for testing when appropriate.
*/
static __inline __attribute__((always_inline))
static NANOLOG_ALWAYS_INLINE
double
getCyclesPerSec()
{
Expand Down
Loading

0 comments on commit b45c104

Please sign in to comment.