Hermes  0.9.5-beta
Hierarchical Distributed I/O Buffering System
buffer_pool_internal.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Distributed under BSD 3-Clause license. *
3  * Copyright by The HDF Group. *
4  * Copyright by the Illinois Institute of Technology. *
5  * All rights reserved. *
6  * *
7  * This file is part of Hermes. The full Hermes copyright notice, including *
8  * terms governing use, modification, and redistribution, is contained in *
9  * the COPYING file, which can be found at the top directory. If you do not *
10  * have access to the file, you may request a copy from help@hdfgroup.org. *
11  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
12 
13 #ifndef HERMES_BUFFER_POOL_INTERNAL_H_
14 #define HERMES_BUFFER_POOL_INTERNAL_H_
15 
16 #include "buffer_pool.h"
17 #include "memory_management.h"
18 
28 namespace hermes {
29 
57 ptrdiff_t InitBufferPool(u8 *hermes_memory, Arena *buffer_pool_arena,
58  Arena *scratch_arena, i32 node_id, Config *config);
59 
71 BufferPool *GetBufferPoolFromContext(SharedMemoryContext *context);
72 
86 Device *GetDeviceById(SharedMemoryContext *context, DeviceID device_id);
87 
109 BufferHeader *GetHeadersBase(SharedMemoryContext *context);
110 
122 BufferHeader *GetHeaderByBufferId(SharedMemoryContext *context, BufferID id);
123 
136 bool HeaderIsDormant(BufferHeader *header);
137 
144 void SplitRamBufferFreeList(SharedMemoryContext *context, int slab_index);
145 
152 void MergeRamBufferFreeList(SharedMemoryContext *context, int slab_index);
153 
157 BufferID PeekFirstFreeBufferId(SharedMemoryContext *context, DeviceID device_id,
158  int slab_index);
159 
163 void LocalReleaseBuffer(SharedMemoryContext *context, BufferID buffer_id);
164 
168 void LocalReleaseBuffers(SharedMemoryContext *context,
169  const std::vector<BufferID> &buffer_ids);
173 i32 GetSlabUnitSize(SharedMemoryContext *context, DeviceID device_id,
174  int slab_index);
175 
179 u32 LocalGetBufferSize(SharedMemoryContext *context, BufferID id);
183 i32 GetSlabBufferSize(SharedMemoryContext *context, DeviceID device_id,
184  int slab_index);
185 
189 void SerializeBufferPoolToFile(SharedMemoryContext *context, FILE *file);
190 
194 void ParseConfig(Arena *arena, const char *path, Config *config);
195 
199 u8 *InitSharedMemory(const char *shmem_name, size_t total_size);
200 
204 u8 *GetRamBufferPtr(SharedMemoryContext *context, BufferID buffer_id);
205 
209 Target *GetTarget(SharedMemoryContext *context, int index);
210 
214 Target *GetTargetFromId(SharedMemoryContext *context, TargetID id);
215 
219 std::atomic<u32> *GetAvailableBuffersArray(SharedMemoryContext *context,
220  DeviceID device_id);
221 } // namespace hermes
222 
223 #endif // HERMES_BUFFER_POOL_INTERNAL_H_
Definition: adapter_utils.cc:35
void MergeRamBufferFreeList(SharedMemoryContext *context, int slab_index)
Definition: buffer_pool.cc:937
BufferHeader * GetHeadersBase(SharedMemoryContext *context)
Definition: buffer_pool.cc:200
Target * GetTargetFromId(SharedMemoryContext *context, TargetID id)
Definition: buffer_pool.cc:167
BufferPool * GetBufferPoolFromContext(SharedMemoryContext *context)
Definition: buffer_pool.cc:140
u8 * GetRamBufferPtr(SharedMemoryContext *context, BufferID buffer_id)
Definition: buffer_pool.cc:792
i32 GetSlabBufferSize(SharedMemoryContext *context, DeviceID device_id, int slab_index)
Definition: buffer_pool.cc:331
BufferHeader * GetHeaderByBufferId(SharedMemoryContext *context, BufferID id)
Definition: buffer_pool.cc:218
Target * GetTarget(SharedMemoryContext *context, int index)
Definition: buffer_pool.cc:158
bool HeaderIsDormant(BufferHeader *header)
Definition: buffer_pool.cc:244
void SerializeBufferPoolToFile(SharedMemoryContext *context, FILE *file)
Definition: buffer_pool.cc:1386
uint8_t u8
Definition: hermes_types.h:40
i32 GetSlabUnitSize(SharedMemoryContext *context, DeviceID device_id, int slab_index)
Definition: buffer_pool.cc:306
u16 DeviceID
Definition: hermes_types.h:51
Device * GetDeviceById(SharedMemoryContext *context, DeviceID device_id)
Definition: buffer_pool.cc:185
BufferID PeekFirstFreeBufferId(SharedMemoryContext *context, DeviceID device_id, int slab_index)
Definition: buffer_pool.cc:435
void LocalReleaseBuffers(SharedMemoryContext *context, const std::vector< BufferID > &buffer_ids)
Definition: buffer_pool.cc:626
void SplitRamBufferFreeList(SharedMemoryContext *context, int slab_index)
Definition: buffer_pool.cc:1076
u8 * InitSharedMemory(const char *shmem_name, size_t total_size)
Definition: buffer_pool.cc:1526
uint32_t u32
Definition: hermes_types.h:42
int32_t i32
Definition: hermes_types.h:46
void ParseConfig(Arena *arena, const char *path, Config *config)
Definition: config_parser.cc:530
void LocalReleaseBuffer(SharedMemoryContext *context, BufferID buffer_id)
Definition: buffer_pool.cc:576
ptrdiff_t InitBufferPool(u8 *shmem_base, Arena *buffer_pool_arena, Arena *scratch_arena, i32 node_id, Config *config)
Definition: buffer_pool.cc:1148
std::atomic< u32 > * GetAvailableBuffersArray(SharedMemoryContext *context, DeviceID device_id)
Definition: buffer_pool.cc:465
u32 LocalGetBufferSize(SharedMemoryContext *context, BufferID id)
Definition: buffer_pool.cc:720