if (out_id >= (int)deps_.size())
deps_.resize(out_id + 1);
- if (deps_[out_id])
+ if (deps_[out_id]) {
+ ++dead_record_count_;
delete deps_[out_id];
+ }
deps_[out_id] = deps;
} else {
StringPiece path(buf, size);
/// wins, allowing updates to just be appended to the file. A separate
/// repacking step can run occasionally to remove dead records.
struct DepsLog {
+ DepsLog() : dead_record_count_(0) {}
// Writing (build-time) interface.
bool OpenForWrite(const string& path, string* err);
// Write a node name record, assigning it an id.
bool RecordId(Node* node);
+ /// Number of deps record read while loading the file that ended up
+ /// being unused (due to a latter entry superceding it).
+ int dead_record_count_;
+
FILE* file_;
/// Maps id -> Node.
vector<Node*> nodes_;