Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
thraneh committed Aug 3, 2024
1 parent 72970f4 commit b241d88
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions include/roq/compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#include <cstddef>

#if defined(__GNUC__)
#define ROQ_PUBLIC __attribute__((visibility("default")))
#define ROQ_HOT __attribute__((hot))
Expand All @@ -15,18 +17,17 @@

#if defined(__APPLE__)
#if defined(__arm64__)
// XXX TODO clang19: check std::hardware_destructive_interference_size
#define ROQ_CACHELINE_SIZE 128
#define ROQ_PAGE_SIZE 16384
inline constexpr size_t const ROQ_CACHELINE_SIZE = 128;
inline constexpr size_t const ROQ_PAGE_SIZE = 16384;
#else // not __arm64__
#define ROQ_CACHELINE_SIZE 64
#define ROQ_PAGE_SIZE 4096
inline constexpr size_t const ROQ_CACHELINE_SIZE = 64;
inline constexpr size_t const ROQ_PAGE_SIZE = 4096;
#endif
#else // not __APPLE__
#define ROQ_CACHELINE_SIZE 64
#define ROQ_PAGE_SIZE 4096
inline constexpr size_t const ROQ_CACHELINE_SIZE = 64;
inline constexpr size_t const ROQ_PAGE_SIZE = 4096;
#endif

// how to find the actual cache-line size
// linux: getconf -a | grep -e PAGE_SIZE -e LEVEL1_DCACHE_LINESIZE
// macos: sysctl -a | grep -e vm.pagesize -e hw.cachelinesize
// how to find the actual cache-line size:
// linux : getconf -a | grep -e PAGE_SIZE -e LEVEL1_DCACHE_LINESIZE
// macos : sysctl -a | grep -e vm.pagesize -e hw.cachelinesize

0 comments on commit b241d88

Please sign in to comment.