xo-expression2 stack: expand MemorySizeInfo w/ per-type detail
This commit is contained in:
parent
94514bf04f
commit
aa946bdc30
3 changed files with 54 additions and 4 deletions
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <xo/reflectutil/typeseq.hpp>
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
#include <cstddef>
|
||||
|
|
@ -12,14 +13,27 @@
|
|||
namespace xo {
|
||||
namespace mm {
|
||||
|
||||
struct MemorySizeDetail {
|
||||
using typeseq = xo::reflect::typeseq;
|
||||
|
||||
/** identifies a c++ type T. See xo/facet/TypeRegistry **/
|
||||
typeseq tseq_;
|
||||
/** number of T-instances **/
|
||||
uint32_t n_alloc_ = 0;
|
||||
/** bytes used by T-instances **/
|
||||
uint32_t z_alloc_ = 0;
|
||||
};
|
||||
|
||||
struct MemorySizeInfo {
|
||||
using size_type = std::size_t;
|
||||
using DetailArrayType = std::array<MemorySizeDetail, 32>;
|
||||
|
||||
MemorySizeInfo() = default;
|
||||
MemorySizeInfo(std::string_view name,
|
||||
std::size_t u, std::size_t a, std::size_t c, std::size_t r)
|
||||
std::size_t u, std::size_t a, std::size_t c, std::size_t r,
|
||||
DetailArrayType * detail)
|
||||
: resource_name_{name},
|
||||
used_{u}, allocated_{a}, committed_{c}, reserved_{r}
|
||||
used_{u}, allocated_{a}, committed_{c}, reserved_{r}, detail_{detail}
|
||||
{}
|
||||
|
||||
static MemorySizeInfo sentinel() { return MemorySizeInfo(); }
|
||||
|
|
@ -36,6 +50,9 @@ namespace xo {
|
|||
* virtual memory addresses range obtained, whether or not committed
|
||||
**/
|
||||
std::size_t reserved_ = 0;
|
||||
|
||||
/** optional histogram with per-data-type counts **/
|
||||
DetailArrayType * detail_ = nullptr;
|
||||
};
|
||||
|
||||
/** function that visits MemorySizeInfo for a collection of @p n memory pools.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue