1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

New account storage stat

This commit is contained in:
SpyCheese 2025-02-28 18:00:36 +03:00
parent 44e7e091b2
commit 57d7c2a895
17 changed files with 479 additions and 177 deletions

View file

@ -113,21 +113,19 @@ class NewCellStorageStat {
struct CellStorageStat {
unsigned long long cells;
unsigned long long bits;
unsigned long long public_cells;
struct CellInfo {
td::uint32 max_merkle_depth = 0;
};
td::HashMap<vm::Cell::Hash, CellInfo> seen;
CellStorageStat() : cells(0), bits(0), public_cells(0) {
CellStorageStat() : cells(0), bits(0) {
}
explicit CellStorageStat(unsigned long long limit_cells)
: cells(0), bits(0), public_cells(0), limit_cells(limit_cells) {
explicit CellStorageStat(unsigned long long limit_cells) : cells(0), bits(0), limit_cells(limit_cells) {
}
void clear_seen() {
seen.clear();
}
void clear() {
cells = bits = public_cells = 0;
cells = bits = 0;
clear_limit();
clear_seen();
}

View file

@ -773,6 +773,14 @@ bool CellSlice::prefetch_maybe_ref(Ref<vm::Cell>& res) const {
}
}
std::vector<Ref<Cell>> CellSlice::prefetch_all_refs() const {
std::vector<Ref<Cell>> res(size_refs());
for (unsigned i = 0; i < size_refs(); ++i) {
res[i] = prefetch_ref(i);
}
return res;
}
bool CellSlice::fetch_maybe_ref(Ref<vm::Cell>& res) {
auto z = prefetch_ulong(1);
if (!z) {

View file

@ -190,6 +190,7 @@ class CellSlice : public td::CntObject {
}
bool fetch_maybe_ref(Ref<Cell>& ref);
bool prefetch_maybe_ref(Ref<Cell>& ref) const;
std::vector<Ref<Cell>> prefetch_all_refs() const;
td::BitSlice fetch_bits(unsigned bits);
td::BitSlice prefetch_bits(unsigned bits) const;
td::Ref<CellSlice> fetch_subslice(unsigned bits, unsigned refs = 0);