OnixS C++ ICE Binary Order Entry Handler 1.1.1
API Documentation
Loading...
Searching...
No Matches
Allocator Class Reference

Public Member Functions

 Allocator ()
 ~Allocator ()
void * allocate (size_t size)
template<typename T>
T * allocate (size_t n)

Detailed Description

Definition at line 57 of file BenchmarkSessionListener.h.

Constructor & Destructor Documentation

◆ Allocator()

Allocator ( )
inline

Definition at line 60 of file BenchmarkSessionListener.h.

61 : chunk_(init())
62 , ptr_(chunk_)
63 , available_(HugePageSize)
64 {
65 }

◆ ~Allocator()

~Allocator ( )
inline

Definition at line 67 of file BenchmarkSessionListener.h.

68 {
69 fini(chunk_);
70 }

Member Function Documentation

◆ allocate() [1/2]

template<typename T>
T * allocate ( size_t n)
inline

Definition at line 92 of file BenchmarkSessionListener.h.

93 {
94 return static_cast<T*>(allocate(sizeof(T) * n));
95 }
void * allocate(size_t size)

◆ allocate() [2/2]

void * allocate ( size_t size)
inline

Definition at line 72 of file BenchmarkSessionListener.h.

73 {
74 size = round(size);
75
76 if(size > available_)
77 throwAllocatorExhausted();
78
79 void* const ptr = ptr_;
80 available_ -= size;
81 ptr_ = Messaging::advanceByBytes(ptr_, size);
82
83#ifdef __GNUC__
84 ::madvise(ptr, size, MADV_SEQUENTIAL);
85 ::madvise(ptr, size, MADV_WILLNEED);
86#endif
87
88 return ptr;
89 }
constexpr std::enable_if<!details::HasMemberTraits< Value >::value, size_t >::type size() noexcept
Definition Memory.h:303