BeesExtent m_dst;
BeesExtent m_plan_tree;
PlanCost m_cost;
+ /// Diagnostics captured at build time (pre-execution): the winning plan's
+ /// signed space-debt (do-nothing-plan.md ยง4) that beat the other
+ /// orientations and the null floor, and this dst's reference count as the
+ /// planner saw it. Logged on the "plan:" line so a chosen plan's debt and
+ /// the fatness of the extent it touched are visible without re-deriving
+ /// them โ e.g. spotting a high-ref extent drained as a dst.
+ double m_space_debt = 0.0;
+ uint64_t m_dst_ref_count = 0;
};
/// Output of the planner: a list of accepted dst plans plus
<< fixed << setprecision(3) << timer.age()
<< "s/" << planner_timer.age() << "s {"
<< to_hex(dst.bytenr()) << "} ["
- << bar << "]");
+ << bar << "] refs " << dst_plan.m_dst_ref_count
+ << " debt " << setprecision(1) << dst_plan.m_space_debt);
return true;
}
ExtentPlan out;
out.m_start_survived = true;
+ // Winning plan's signed debt and this layer, for the per-dst diagnostics
+ // recorded below (logged on the "plan:" line). refs() reads here are the
+ // planner's cached, pre-execution values.
+ auto &diag_layer = Borrower::current().layer();
+ const double winner_space_debt = winner.cost().m_space_debt;
+
if (auto *pa = dynamic_cast<const BeesStartAsDstPlan *>(&winner)) {
const auto *impl = pa->impl();
if (!impl) {
return out;
}
+ dp->m_space_debt = winner_space_debt;
+ dp->m_dst_ref_count = start.refs(diag_layer)->size();
out.m_total_cost = dp->m_cost;
for (const auto &g : groups) {
out.m_src_bytenrs.insert(g.m_extent.bytenr());
auto dp = scan_next_try_build_dst_plan(ctx,
entry.m_candidate, sources, policy, force);
if (dp) {
+ dp->m_space_debt = winner_space_debt;
+ dp->m_dst_ref_count =
+ entry.m_candidate.refs(diag_layer)->size();
out.m_total_cost += dp->m_cost;
out.m_dst_plans.push_back(std::move(*dp));
}