void Pool::DelayEdge(Edge* edge) {
assert(depth_ != 0);
- delayed_.push(edge);
+ delayed_.push_back(edge);
}
void Pool::RetrieveReadyEdges(set<Edge*>* ready_queue) {
Edge* edge = delayed_.front();
if(current_use_ + edge->weight() > depth_)
break;
- delayed_.pop();
+ delayed_.pop_front();
ready_queue->insert(edge);
EdgeScheduled(*edge);
}
}
+void Pool::Dump() const {
+ printf("%s (%d/%d) ->\n", name_.c_str(), current_use_, depth_);
+ for (deque<Edge*>::const_iterator it = delayed_.begin();
+ it != delayed_.end(); ++it)
+ {
+ printf("\t");
+ (*it)->Dump();
+ }
+}
+
Pool State::kDefaultPool("", 0);
const Rule State::kPhonyRule("phony");
node->status_known() ? (node->dirty() ? "dirty" : "clean")
: "unknown");
}
+ if(!pools_.empty()) {
+ printf("resource_pools:\n");
+ for (map<string, Pool*>::const_iterator it = pools_.begin();
+ it != pools_.end(); ++it)
+ {
+ it->second->Dump();
+ }
+ }
}
#define NINJA_STATE_H_
#include <map>
-#include <queue>
+#include <deque>
#include <set>
#include <string>
#include <vector>
/// Pool will add zero or more edges to the ready_queue
void RetrieveReadyEdges(set<Edge*>* ready_queue);
+ /// Dump the Pool and it's edges (useful for debugging).
+ void Dump() const;
+
private:
int UnitsWaiting() { return delayed_.size(); }
int current_use_;
int depth_;
- queue<Edge*> delayed_;
+ deque<Edge*> delayed_;
};
/// Global state (file status, loaded rules) for a single run.
/// state where we haven't yet examined the disk for dirty state.
void Reset();
- /// Dump the nodes (useful for debugging).
+ /// Dump the nodes and Pools (useful for debugging).
void Dump();
/// @return the root node(s) of the graph. (Root nodes have no output edges).