diff --git a/ECSMemoryPool/ECSMemoryPool.vcxproj b/ECSMemoryPool/ECSMemoryPool.vcxproj
index 4c64a7c..cc4e118 100644
--- a/ECSMemoryPool/ECSMemoryPool.vcxproj
+++ b/ECSMemoryPool/ECSMemoryPool.vcxproj
@@ -16,6 +16,7 @@
10.0
10.0
$(MSBuildProjectDirectory)\QtMsBuild
+ ECSChunkPool
diff --git a/ECSMemoryPool/ecs_memorypool.h b/ECSMemoryPool/ecs_memorypool.h
index 59e0fe2..ba43a97 100644
--- a/ECSMemoryPool/ecs_memorypool.h
+++ b/ECSMemoryPool/ecs_memorypool.h
@@ -82,13 +82,13 @@ public:
// 迭代内存页集合
for (auto page_ptr : page_list) {
- auto max_element_cnt = page_ptr->maxSliceCount();
+ auto max_element_cnt = page_ptr->maxChunkCapacity();
auto active_cnt = page_ptr->getActiveCount();
// 初级校核可用数量
if (active_cnt < max_element_cnt) {
// 逐个查找数据元素
for (auto eidx = 0; eidx < max_element_cnt; eidx++) {
- auto slice_ptr = page_ptr->getSlicePtr(eidx);
+ auto slice_ptr = page_ptr->getChunkPtr(eidx);
// 访问排他
slice_ptr->page_refer->lock();
// 裁决元素可用性
@@ -111,7 +111,7 @@ public:
// 生成新的内存页
auto new_page = new MemoryPage(MemoryElement::rawSize(T::typeSize()), type_code);
_storage_pages.insert(type_code, new_page);
- refer_ptr = new_page->getSlicePtr(0);
+ refer_ptr = new_page->getChunkPtr(0);
refer_ptr->page_refer->getActiveCount(1);
refer_ptr->refer_count++;
}
diff --git a/ECSMemoryPool/memory_pages.cpp b/ECSMemoryPool/memory_pages.cpp
index 4a31212..b12ef19 100644
--- a/ECSMemoryPool/memory_pages.cpp
+++ b/ECSMemoryPool/memory_pages.cpp
@@ -7,7 +7,7 @@ MemoryPage::MemoryPage(uint16_t element_size, uint64_t typecode)
pcb.typecode_of_element = typecode;
}
-uint16_t MemoryPage::dataSliceSize() const
+uint16_t MemoryPage::chunkSize() const
{
return pcb.byte_count_per_element - MemoryElement::data_buffer_offset;
}
@@ -39,9 +39,9 @@ std::pair MemoryPage::getRecords() const {
return std::make_pair(pcb.curr_access_usec, pcb.acc_count_per_cycle);
}
-ElementControlBlock* MemoryPage::getSlicePtr(int index) {
- auto member_cnt = maxSliceCount();
- auto element_size = sliceRawSize();
+ElementControlBlock* MemoryPage::getChunkPtr(int index) {
+ auto member_cnt = maxChunkCapacity();
+ auto element_size = chunkRawSize();
ElementControlBlock* element_ptr = nullptr;
if (index >= 0 && index < member_cnt) {
@@ -79,15 +79,15 @@ uint64_t MemoryPage::elementTypeCode() const
return pcb.typecode_of_element;
}
-uint16_t MemoryPage::sliceRawSize() const {
+uint16_t MemoryPage::chunkRawSize() const {
auto data_ptr = const_cast(this);
std::lock_guard g(data_ptr->pcb.access_protected);
return pcb.byte_count_per_element;
}
-uint16_t MemoryPage::maxSliceCount() const {
+uint16_t MemoryPage::maxChunkCapacity() const {
uint16_t cnt = sizeof(data_buffer);
- return cnt / this->sliceRawSize();
+ return cnt / this->chunkRawSize();
}
// element =================================================================
@@ -114,7 +114,7 @@ MemoryElement::MemoryElement(ElementControlBlock* access_bind)
uint16_t MemoryElement::typeSize() const
{
auto page_ptr = data_ptr->page_refer;
- return page_ptr->sliceRawSize();
+ return page_ptr->chunkRawSize();
}
void MemoryElement::accessUpdate(uint64_t time_usec)
diff --git a/ECSMemoryPool/memory_pages.h b/ECSMemoryPool/memory_pages.h
index 83d5960..153e276 100644
--- a/ECSMemoryPool/memory_pages.h
+++ b/ECSMemoryPool/memory_pages.h
@@ -55,7 +55,7 @@ public:
/// 内存存储的数据元素的尺寸
///
///
- uint16_t dataSliceSize() const;
+ uint16_t chunkSize() const;
///
/// 获取当前活跃元素数量
@@ -95,7 +95,7 @@ public:
/// 元素索引
/// 是否设置
/// 数据指针
- ElementControlBlock* getSlicePtr(int index);
+ ElementControlBlock* getChunkPtr(int index);
///
/// 元素类型码
///
@@ -105,12 +105,12 @@ public:
/// 获取单个元素尺寸
///
/// 字节数量
- uint16_t sliceRawSize() const;
+ uint16_t chunkRawSize() const;
///
/// 获取元素数量
///
///
- uint16_t maxSliceCount() const;
+ uint16_t maxChunkCapacity() const;
};
///
diff --git a/QtConsoleApplication1/QtConsoleApplication1.vcxproj b/QtConsoleApplication1/QtConsoleApplication1.vcxproj
index a2e13ef..c74f05e 100644
--- a/QtConsoleApplication1/QtConsoleApplication1.vcxproj
+++ b/QtConsoleApplication1/QtConsoleApplication1.vcxproj
@@ -70,7 +70,7 @@
stdcpp20
- ECSMemoryPool.lib;%(AdditionalDependencies)
+ ECSChunkPool.lib;%(AdditionalDependencies)