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>
62 lines
2.0 KiB
C++
62 lines
2.0 KiB
C++
#include "hotplug.hpp"
|
|
#include <sstream>
|
|
|
|
namespace hotplug {
|
|
std::string Engine::observe(int result) const {
|
|
std::ostringstream output;
|
|
output << "R " << result << '\n';
|
|
for (const auto &event : ledger_.events()) {
|
|
output << "E " << event.kind;
|
|
output << ' ' << event.key;
|
|
output << ' ' << event.cpu;
|
|
output << ' ' << event.ticket;
|
|
output << ' ' << event.detail << '\n';
|
|
}
|
|
const auto &totals = ledger_.counters();
|
|
output << "S " << static_cast<int>(ready_);
|
|
output << ' ' << cpu_count_;
|
|
output << ' ' << online_.bits();
|
|
output << ' ' << online_.count();
|
|
output << ' ' << ledger_.next_ticket();
|
|
output << ' ' << totals.attempts;
|
|
output << ' ' << totals.failures;
|
|
output << ' ' << totals.stops;
|
|
output << ' ' << totals.registrations;
|
|
output << ' ' << totals.removals;
|
|
output << ' ' << totals.ups;
|
|
output << ' ' << totals.downs;
|
|
output << ' ' << totals.syncs;
|
|
output << ' ' << states_.size() << '\n';
|
|
for (const auto &state : descriptors()) {
|
|
output << "D " << state.key;
|
|
output << ' ' << state.priority;
|
|
output << ' ' << state.tag;
|
|
output << ' ' << state.replay;
|
|
output << ' ' << ledger_.cohort(state.key).bits() << '\n';
|
|
}
|
|
for (int key = 1; key <= max_keys; ++key) {
|
|
const auto cohort = ledger_.cohort(key);
|
|
for (int cpu : cohort.ascending()) {
|
|
const auto &entry = ledger_.lease(key, cpu);
|
|
output << "L " << key;
|
|
output << ' ' << cpu;
|
|
output << ' ' << entry.ticket;
|
|
output << ' ' << entry.tag << '\n';
|
|
}
|
|
}
|
|
for (int key = 1; key <= max_keys; ++key) {
|
|
for (int cpu = 0; cpu < max_cpus; ++cpu) {
|
|
const int count = ledger_.budget(key, cpu);
|
|
if (count == 0) {
|
|
continue;
|
|
}
|
|
output << "F " << key;
|
|
output << ' ' << cpu;
|
|
output << ' ' << count << '\n';
|
|
}
|
|
}
|
|
output << "END\n";
|
|
return output.str();
|
|
}
|
|
}
|