git subrepo clone git@github.com:Rconybea/xo-alloc.git xo-alloc
subrepo: subdir: "xo-alloc" merged: "fc656313" upstream: origin: "git@github.com:Rconybea/xo-alloc.git" branch: "main" commit: "fc656313" git-subrepo: version: "0.4.9" origin: "???" commit: "???"
This commit is contained in:
parent
d16545d815
commit
2c8faf6e43
49 changed files with 7196 additions and 0 deletions
73
xo-alloc/src/alloc/ObjectStatistics.cpp
Normal file
73
xo-alloc/src/alloc/ObjectStatistics.cpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/* file ObjectStatistics.cpp
|
||||
*
|
||||
* author: Roland Conybeare, Aug 2025
|
||||
*/
|
||||
|
||||
#include "ObjectStatistics.hpp"
|
||||
#include "xo/reflect/TypeDescr.hpp"
|
||||
#include "xo/indentlog/print/pretty_vector.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace gc {
|
||||
void
|
||||
PerObjectTypeStatistics::display(std::ostream & os) const
|
||||
{
|
||||
os << "<PerObjectTypeStatistics";
|
||||
if (td_)
|
||||
os << xrtag("td", td_->short_name());
|
||||
else
|
||||
os << xrtag("td", "nullptr");
|
||||
os << xrtag("scanned_n", scanned_n_)
|
||||
<< xrtag("scanned_z", scanned_z_)
|
||||
<< xrtag("survive_n", survive_n_)
|
||||
<< xrtag("survive_z", survive_z_)
|
||||
<< ">";
|
||||
}
|
||||
|
||||
void
|
||||
ObjectStatistics::display(std::ostream & os) const
|
||||
{
|
||||
os << "<ObjectStatistics";
|
||||
|
||||
std::size_t i = 0;
|
||||
for (const auto & x : per_type_stats_v_) {
|
||||
os << " :[" << i << "] " << x;
|
||||
}
|
||||
|
||||
os << ">";
|
||||
}
|
||||
} /*namespace gc*/
|
||||
|
||||
namespace print {
|
||||
bool
|
||||
ppdetail<xo::gc::PerObjectTypeStatistics>::print_pretty(const ppindentinfo & ppii,
|
||||
const xo::gc::PerObjectTypeStatistics & x)
|
||||
{
|
||||
static constexpr std::string_view c_nullptr_str = "nullptr";
|
||||
|
||||
if (x.td_) {
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"PerObjectTypeStatistics",
|
||||
refrtag("td", x.td_ ? x.td_->short_name() : c_nullptr_str),
|
||||
refrtag("scanned_n", x.scanned_n_),
|
||||
refrtag("scanned_z", x.scanned_z_),
|
||||
refrtag("survive_n", x.survive_n_),
|
||||
refrtag("survive_z", x.survive_z_));
|
||||
} else {
|
||||
/* print nothing -- empty struct */
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ppdetail<xo::gc::ObjectStatistics>::print_pretty(const ppindentinfo & ppii,
|
||||
const xo::gc::ObjectStatistics & x)
|
||||
{
|
||||
return ppii.pps()->pretty_struct(ppii,
|
||||
"ObjectTypeStatistics",
|
||||
refrtag("per_type_stats_v", x.per_type_stats_v_));
|
||||
}
|
||||
} /*namespace gc*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end ObjectStatistics.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue