Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast Concurrent Data-Structures Through Explicit Timestamping(deque) #55

Open
wants to merge 16 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions cds/compiler/gcc/amd64/timestamp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef CDSLIB_COMPILER_GCC_AMD64_TIMESTAMP_H
#define CDSLIB_COMPILER_GCC_AMD64_TIMESTAMP_H

//@cond none

namespace cds { namespace timestamp {
namespace gcc { namespace amd64 {

# define CDS_timestamp_defined
inline unsigned long getTimestamp ()
{
uint32_t time_edx1, time_eax1;
unsigned long time_last;
asm volatile ( "rdtscp\n\t"
"mov %%edx, %0\n\t"
"mov %%eax, %1\n\t"
"cpuid\n\t" : "=r"(time_edx1), "=r"(time_eax1) ::
"%rax", "%rbx", "%rcx", "%rdx");

time_last =
(static_cast<unsigned long long>(time_edx1) << 32 | static_cast<unsigned long long>(time_eax1));
return time_last;
}
}} // namespace gcc::amd64

namespace platform {
using namespace gcc::amd64;
}
}} // namespace cds::timestamp

//@endcond
#endif // #ifndef CDSLIB_COMPILER_GCC_AMD64_TIMESTAMP_H
30 changes: 30 additions & 0 deletions cds/compiler/gcc/x86/timestamp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

#ifndef CDSLIB_COMPILER_GCC_X86_TIMESTAMP_H
#define CDSLIB_COMPILER_GCC_X86_TIMESTAMP_H
namespace cds { namespace timestamp {
namespace gcc { namespace x86 {

# define CDS_timestamp_defined
inline unsigned long getTimestamp ()
{
uint32_t time_edx1, time_eax1;
unsigned long time_last;
asm volatile ( "rdtscp\n\t"
"mov %%edx, %0\n\t"
"mov %%eax, %1\n\t"
"cpuid\n\t" : "=r"(time_edx1), "=r"(time_eax1) ::
"%rax", "%rbx", "%rcx", "%rdx");

time_last =
(static_cast<unsigned long long>(time_edx1) << 32 | static_cast<unsigned long long>(time_eax1));
return time_last;
}

}} // namespace gcc::x86

namespace platform {
using namespace gcc::x86;
}
}} // namespace cds::timestamp

#endif //CDSLIB_COMPILER_GCC_X86_TIMESTAMP_H
36 changes: 36 additions & 0 deletions cds/compiler/timestamp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// Created by light on 4/4/16.
//

#ifndef CDSLIB_COMPILER_TIMESTAMP_IMPL_H
#define CDSLIB_COMPILER_TIMESTAMP_IMPL_H



#if CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)
# if CDS_PROCESSOR_ARCH == CDS_PROCESSOR_X86
# include <cds/compiler/vc/x86/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_AMD64
# include <cds/compiler/vc/amd64/timestamp.h>
# else
# error "MS VC++ compiler: unsupported processor architecture"
# endif
#elif CDS_COMPILER == CDS_COMPILER_GCC || CDS_COMPILER == CDS_COMPILER_CLANG || CDS_COMPILER == CDS_COMPILER_INTEL
# if CDS_PROCESSOR_ARCH == CDS_PROCESSOR_X86
# include <cds/compiler/gcc/x86/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_AMD64
# include <cds/compiler/gcc/amd64/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_IA64
# include <cds/compiler/gcc/ia64/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_SPARC
# include <cds/compiler/gcc/sparc/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_PPC64
# include <cds/compiler/gcc/ppc64/timestamp.h>
# elif CDS_PROCESSOR_ARCH == CDS_PROCESSOR_ARM7
# include <cds/compiler/gcc/arm7/timestamp.h>
# endif
#else
# error "Undefined compiler"
#endif

#endif // #ifndef CDSLIB_COMPILER_TIMESTAMP_IMPL_H
Loading