amos 2f32624d3b Batch 18 (20261026-C-hwe-codegen-18): add 100 calibrated HWE code-gen tasks; pause production for rollout
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>
2026-10-27 17:52:13 +08:00

108 lines
4.4 KiB
C++

#include "reference_ledger.hpp"
#include <iostream>
#include <string>
#include <vector>
using reference::Number;
using reference::View;
void print_view(const View &v)
{
std::cout << ' ' << v.id << ' ' << v.payload << ' ' << v.incarnation
<< ' ' << v.state << ' ' << v.base << ' ' << v.total << ' ' << v.cpus;
}
int main()
{
reference::Ledger ledgers[2];
unsigned selected = 0;
std::string op;
while (std::cin >> op) {
auto &ledger = ledgers[selected];
Number id = 0, cpu = 0, n = 0, nonce = 0;
if (op == "U") {
std::cin >> selected;
std::cout << "U " << selected << '\n';
} else if (op == "Z") {
std::cin >> n;
std::cout << "R " << ledger.reset(n) << '\n';
} else if (op == "C") {
std::cin >> id >> n;
std::cout << "R " << ledger.create(id, n) << '\n';
} else if (op == "G" || op == "P") {
std::cin >> id >> cpu >> n;
int rc = op == "G" ? ledger.get(id, cpu, n) : ledger.put(id, cpu, n);
std::cout << "R " << rc << '\n';
} else if (op == "F") {
std::cin >> id >> cpu;
std::cout << "R " << ledger.fold_cpu(id, cpu) << '\n';
} else if (op == "A" || op == "K" || op == "E" || op == "I") {
std::cin >> id;
int rc = 0;
if (op == "A") rc = ledger.fold_all(id);
if (op == "K") rc = ledger.kill(id);
if (op == "E") rc = ledger.erase(id);
if (op == "I") rc = ledger.contains(id);
std::cout << (op == "I" ? "I " : "R ") << rc << '\n';
} else if (op == "Q") {
std::cin >> id >> nonce;
View value{nonce, nonce, nonce, nonce, nonce, nonce, nonce};
int rc = ledger.query(id, value);
std::cout << "Q " << rc;
print_view(value);
std::cout << '\n';
} else if (op == "D") {
std::cin >> id >> cpu >> nonce;
reference::CpuView value{nonce, nonce, nonce};
int rc = ledger.query_cpu(id, cpu, value);
std::cout << "D " << rc << ' ' << value.local << ' ' << value.folded
<< ' ' << value.pending << '\n';
} else if (op == "T") {
std::cin >> id >> nonce;
int rc = ledger.total(id, nonce);
std::cout << "T " << rc << ' ' << nonce << '\n';
} else if (op == "N") {
std::cout << "N " << ledger.resident_count() << ' ' << ledger.cpu_count() << '\n';
} else if (op == "L") {
auto events = ledger.events();
std::cout << "L " << events.size();
for (const auto &v : events) {
std::cout << ' ' << v.sequence << ' ' << v.id << ' ' << v.incarnation << ' ' << v.payload;
}
std::cout << '\n';
} else if (op == "S") {
auto v = ledger.stats();
std::cout << "S " << v.active << ' ' << v.killed << ' ' << v.released
<< ' ' << v.total << ' ' << v.pending << ' ' << v.releases << '\n';
} else if (op == "H") {
std::cin >> n >> nonce;
reference::Release value{nonce, nonce, nonce, nonce};
int rc = ledger.event(n, value);
std::cout << "H " << rc << ' ' << value.sequence << ' ' << value.id
<< ' ' << value.incarnation << ' ' << value.payload << '\n';
} else if (op == "V") {
std::cin >> n >> nonce;
std::vector<Number> ids(static_cast<std::size_t>(n));
for (auto &v : ids) std::cin >> v;
std::vector<View> output{{nonce, nonce, nonce, nonce, nonce, nonce, nonce}};
int rc = ledger.select(ids, output);
std::cout << "V " << rc << ' ' << output.size();
for (const auto &v : output) print_view(v);
std::cout << '\n';
} else if (op == "B") {
std::cin >> n >> nonce;
std::vector<reference::Op> operations(static_cast<std::size_t>(n));
for (auto &v : operations) std::cin >> v.kind >> v.id >> v.cpu >> v.amount;
std::vector<Number> totals{nonce, nonce + 1};
int rc = ledger.batch(operations, totals);
std::cout << "B " << rc << ' ' << totals.size();
for (auto v : totals) std::cout << ' ' << v;
std::cout << '\n';
} else {
return 2;
}
if (!std::cin) return 2;
}
return std::cin.bad() ? 2 : 0;
}