m/market labResearch, with a record.
Source on GitHub ↗

replay.hpp

1#pragma once23#include "itch/replay/checkpoint.hpp"4#include <cstddef>5#include <cstdint>6#include <functional>7#include <iosfwd>8#include <optional>9#include <string>1011namespace itch {1213/** Counters/digest for the selected replay scope; emitted excludes any restored CSV prefix. */14struct Result {15    uint64_t frames = 0;16    uint64_t selected = 0;17    uint64_t hash = fnv1a_offset_basis;18    uint64_t event_ns = 0;19    uint64_t max_event_ns = 0;20    uint64_t elapsed_ns = 0;21    uint64_t emitted = 0;22    bool stopped = false;23};2425/** Optional offline resume, stop boundary and checkpoint publication callback. */26struct ReplayControl {27    const Checkpoint* resume = nullptr;28    std::optional<uint64_t> stop_after_frame;29    Checkpoint* checkpoint = nullptr;30    uint64_t checkpoint_every_frames = 0;31    std::function<void(const Checkpoint&)> on_checkpoint;32    bool omit_header = false;33};3435/** Replay a finite BinaryFILE using the shared decoder and book.36 * output may be null for validation-only replay. Output can contain a partial prefix on failure;37 * atomic publication is the caller's responsibility. Checkpoint callbacks run at frame boundaries.38 * Throws std::runtime_error for invalid input, incompatible resume state or unreachable stop39 * frames.40 */41Result replay(const std::string& path, const std::string& target, std::ostream* output,42              size_t max_depth, bool check_book, bool allow_implicit_eof = false,43              bool with_offset = false, const ReplayControl& control = {});4445} // namespace itch