upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/dstorage_hold.h
blob: 1695c1e7c8c7763152ee37e70fc443edc3e74902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Counters of the DirectStorage queues' rule "reads into physical pages wait for the title's Submit"
// (shims/dstorage.cpp, docs/directstorage.md). Process-wide, so the log line and the test read the same numbers.
#pragma once

#include <atomic>
#include <cstdint>

namespace leonida::dstorage {

struct HoldStats {
    std::atomic<uint64_t> self_submits{0};    // a queue half full submitted itself
    std::atomic<uint64_t> held_reads{0};      // reads into physical pages such a submit left for the title's Submit
    std::atomic<uint64_t> full_releases{0};   // a full queue submitted its held entries (the title waits in an enqueue)
    std::atomic<uint64_t> timed_releases{0};  // LEONIDA_DSTORAGE_HOLD_MS ran out before the title's Submit
    std::atomic<uint64_t> page0_entries{0};   // destination page lists that named page 0 when their data was written
};

inline HoldStats& hold_stats() {
    static HoldStats stats;
    return stats;
}

}  // namespace leonida::dstorage