Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrumentation for memory measurement: FilteredData and FilteredDataBlock. #4779

Merged
merged 5 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tiledb/common/memory_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ std::string memory_type_to_str(MemoryType type) {
return "EnumerationPaths";
case MemoryType::FOOTER:
return "Footer";
case MemoryType::FILTERED_DATA:
return "FilteredData";
case MemoryType::FILTERED_DATA_BLOCK:
return "FilteredDataBlock";
case MemoryType::GENERIC_TILE_IO:
return "GenericTileIO";
case MemoryType::RTREE:
Expand Down
2 changes: 2 additions & 0 deletions tiledb/common/memory_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ enum class MemoryType {
ENUMERATION,
ENUMERATION_PATHS,
FOOTER,
FILTERED_DATA,
FILTERED_DATA_BLOCK,
GENERIC_TILE_IO,
RTREE,
TILE_DATA,
Expand Down
62 changes: 62 additions & 0 deletions tiledb/common/pmr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#ifndef TILEDB_COMMON_PMR_H
#define TILEDB_COMMON_PMR_H

#include <list>
#include <map>
#include <unordered_map>
#include <vector>
Expand Down Expand Up @@ -120,6 +121,67 @@ unique_ptr<Tp> make_unique(memory_resource* resource, size_t size) {
return make_unique<Tp>(resource, size, alignof(Tp));
}

/* ********************************* */
/* PMR LIST DECLARATION */
/* ********************************* */
template <class Tp>
using pmr_list = std::list<Tp, polymorphic_allocator<Tp>>;

template <class Tp>
class list : public pmr_list<Tp> {
public:
using value_type = typename pmr_list<Tp>::value_type;
using allocator_type = typename pmr_list<Tp>::allocator_type;
using size_type = typename pmr_list<Tp>::size_type;
using difference_type = typename pmr_list<Tp>::difference_type;
using reference = typename pmr_list<Tp>::reference;
using const_reference = typename pmr_list<Tp>::const_reference;
using pointer = typename pmr_list<Tp>::pointer;
using const_pointer = typename pmr_list<Tp>::const_pointer;
using iterator = typename pmr_list<Tp>::iterator;
using const_iterator = typename pmr_list<Tp>::const_iterator;
using reverse_iterator = typename pmr_list<Tp>::reverse_iterator;
using const_reverse_iterator = typename pmr_list<Tp>::const_reverse_iterator;

// Delete all default constructors because they don't require an allocator
list() = delete;
list(const list& other) = delete;
list(list&& other) = delete;

// Delete non-allocator aware copy and move assign.
list& operator=(const list& other) = delete;
list& operator=(list&& other) noexcept = delete;

explicit list(const allocator_type& alloc) noexcept
: pmr_list<Tp>(alloc) {
}

explicit list(size_type count, const Tp& value, const allocator_type& alloc)
: pmr_list<Tp>(count, value, alloc) {
}

explicit list(size_type count, const allocator_type& alloc)
: pmr_list<Tp>(count, alloc) {
}

template <class InputIt>
list(InputIt first, InputIt last, const allocator_type& alloc)
: pmr_list<Tp>(first, last, alloc) {
}

list(const list& other, const allocator_type& alloc)
: pmr_list<Tp>(other, alloc) {
}

list(list&& other, const allocator_type& alloc)
: pmr_list<Tp>(other, alloc) {
}

list(std::initializer_list<Tp> init, const allocator_type& alloc)
: pmr_list<Tp>(init, alloc) {
}
};

/* ********************************* */
/* PMR VECTOR DECLARATION */
/* ********************************* */
Expand Down
Loading
Loading