xo-interpreter2 .. xo-arena. memory pool introspection
This commit is contained in:
parent
6db1ddc802
commit
bfc7a1d379
3 changed files with 19 additions and 16 deletions
|
|
@ -61,14 +61,14 @@ namespace xo {
|
|||
using Stack = void *;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
using MemorySizeInfo = xo::mm::MemorySizeInfo;
|
||||
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
|
||||
using span_type = xo::mm::span<const char>;
|
||||
|
||||
public:
|
||||
VirtualSchematikaMachine(const VsmConfig & config);
|
||||
|
||||
size_t _n_store() const noexcept;
|
||||
MemorySizeInfo _store_info(std::size_t i) const noexcept;
|
||||
/** visit vsm-owned memory pools; call visitor(info) for each **/
|
||||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
||||
/** begin interactive session. **/
|
||||
void begin_interactive_session();
|
||||
|
|
|
|||
|
|
@ -30,20 +30,11 @@ namespace xo {
|
|||
reader_{config.rdr_config_, mm_.to_op()}
|
||||
{}
|
||||
|
||||
std::size_t
|
||||
VirtualSchematikaMachine::_n_store() const noexcept
|
||||
void
|
||||
VirtualSchematikaMachine::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
// oops. need something that goes through AAllocator api
|
||||
|
||||
return reader_._n_store();
|
||||
}
|
||||
|
||||
MemorySizeInfo
|
||||
VirtualSchematikaMachine::_store_info(std::size_t i) const noexcept
|
||||
{
|
||||
// oops. need something poly that goes through AAllocator api
|
||||
|
||||
return reader_._store_info(i);
|
||||
mm_.visit_pools(visitor);
|
||||
reader_.visit_pools(visitor);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace xo {
|
|||
using xo::scm::VsmResultExt;
|
||||
using xo::scm::DFloat;
|
||||
using xo::mm::AGCObject;
|
||||
using xo::mm::MemorySizeInfo;
|
||||
using span_type = xo::scm::VirtualSchematikaMachine::span_type;
|
||||
using Catch::Matchers::WithinAbs;
|
||||
|
||||
|
|
@ -55,6 +56,8 @@ namespace xo {
|
|||
namespace ut {
|
||||
TEST_CASE("VirtualSchematikaMachine-ctor", "[interpreter2][VSM]")
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
VsmConfig cfg;
|
||||
VirtualSchematikaMachine vsm(cfg);
|
||||
|
||||
|
|
@ -73,6 +76,15 @@ namespace xo {
|
|||
|
||||
REQUIRE(res.remaining_.size() == 1);
|
||||
REQUIRE(*res.remaining_.lo() == '\n');
|
||||
|
||||
auto visitor = [&log](const MemorySizeInfo & info) {
|
||||
log && log(xtag("resource", info.resource_name_),
|
||||
xtag("alloc", info.allocated_),
|
||||
xtag("commit", info.committed_),
|
||||
xtag("resv", info.reserved_));
|
||||
};
|
||||
|
||||
vsm.visit_pools(visitor);
|
||||
}
|
||||
|
||||
} /*namespace ut*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue