• Docs >
  • Program Listing for File cache.hpp
Shortcuts

Program Listing for File cache.hpp

Return to documentation for file (include/ripple/arch/cache.hpp)

#ifndef RIPPLE_ARCH_CACHE_HPP
#define RIPPLE_ARCH_CACHE_HPP

#include <cstdint>

namespace ripple {

static constexpr size_t avoid_false_sharing_size =
#if defined(RIPPLE_AVOID_FALSE_SHARING_SIZE)
  RIPPLE_AVOID_FALSE_SHARING_SIZE;
#else
  // Not yet implemented, so just use the most popular cache line size.
  64;
#endif

struct Cache {
  static constexpr uint32_t bytes_in_kb = 1024;

  enum Type : uint32_t {
    Null        = 0x0,
    Data        = 0x1,
    Instruction = 0x2,
    Unified     = 0x3
  };

  auto size() const -> uint32_t {
    return assosciativity * partitions * linesize * sets / bytes_in_kb;
  }

  Type     type           = Type::Null;
  uint32_t level          = 0;
  uint32_t linesize       = 0;
  uint32_t partitions     = 0;
  uint32_t assosciativity = 0;
  uint32_t shared_by      = 0;
  uint32_t sets           = 0;
  uint32_t mask           = 0;
};

} // namespace ripple

#endif // RIPPLE_ARCH_CACHE_HPP

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples