100 tasks from the HWE arm-linux code-gen pool (outside the lk/man/pth range given to batch 22), each with at least one independent contract-edge defect and plain public docs. Claude reviewed 100/100 USABLE against current digests; no ID or source overlap with main or batch 22. Difficulty is unmeasured. progress.md records the wrap-up: all Codex sessions and Qwen schedulers stopped for the user's rollout, Qwen results so far (57 HARD of 373), and what is left on each batch branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
#ifndef EDF_DISPATCH_HPP
|
|
#define EDF_DISPATCH_HPP
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string_view>
|
|
#include <vector>
|
|
namespace edf {
|
|
constexpr std::int64_t MAX_TIME = 1000000000000LL;
|
|
enum Status { Ok=0, Invalid=-1, Missing=-2, Exists=-3, Busy=-4,
|
|
Full=-5, Range=-6, Empty=-7, Syntax=-8, Limit=-9 };
|
|
enum EventKind { Partial=1, Done=2, Missed=3 };
|
|
struct Event {
|
|
std::int64_t id = 0;
|
|
std::uint64_t tag = 0;
|
|
int kind = 0;
|
|
std::uint64_t start = 0;
|
|
std::uint64_t end = 0;
|
|
std::uint64_t deadline = 0;
|
|
std::uint64_t serial = 0;
|
|
std::uint64_t used = 0;
|
|
std::uint64_t remaining = 0;
|
|
};
|
|
struct RunResult {
|
|
int code = Ok;
|
|
std::vector<Event> events;
|
|
};
|
|
struct Stats {
|
|
std::uint64_t capacity = 0;
|
|
std::uint64_t now = 0;
|
|
std::uint64_t defined = 0;
|
|
std::uint64_t active = 0;
|
|
std::uint64_t submitted = 0;
|
|
std::uint64_t completed = 0;
|
|
std::uint64_t cancelled = 0;
|
|
std::uint64_t missed = 0;
|
|
std::uint64_t executed = 0;
|
|
};
|
|
struct View {
|
|
std::int64_t id = 0;
|
|
std::uint64_t relative = 0;
|
|
std::uint64_t budget = 0;
|
|
bool active = false;
|
|
std::uint64_t release = 0;
|
|
std::uint64_t deadline = 0;
|
|
std::uint64_t remaining = 0;
|
|
std::uint64_t serial = 0;
|
|
std::uint64_t tag = 0;
|
|
};
|
|
class Dispatcher {
|
|
public:
|
|
Dispatcher();
|
|
~Dispatcher();
|
|
Dispatcher(const Dispatcher& other);
|
|
Dispatcher& operator=(const Dispatcher& other);
|
|
int reset(std::int64_t capacity, std::int64_t now);
|
|
int define(std::int64_t id, std::int64_t relative, std::int64_t budget);
|
|
int update(std::int64_t id, std::int64_t relative, std::int64_t budget);
|
|
int erase(std::int64_t id);
|
|
int post(std::int64_t id, std::int64_t delay, std::int64_t tag);
|
|
int cancel(std::int64_t id);
|
|
int retime(std::int64_t id, std::int64_t delay);
|
|
int advance(std::int64_t delta);
|
|
RunResult run(std::int64_t cpu_limit);
|
|
Stats stats() const;
|
|
std::vector<View> inspect() const;
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> state_;
|
|
};
|
|
struct PlanResult {
|
|
int code = Ok;
|
|
std::uint64_t index = 0;
|
|
};
|
|
PlanResult apply_plan(Dispatcher& dispatcher, std::string_view text);
|
|
}
|
|
#endif
|