From: Robert Iannucci Date: Fri, 9 Nov 2012 20:07:12 +0000 (-0800) Subject: Dump pools with State X-Git-Tag: v1.1.0^2~15^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5bf183fd9ae7745effbce5dee1e76432c865d5a;p=platform%2Fupstream%2Fninja.git Dump pools with State --- diff --git a/src/build.cc b/src/build.cc index 2794c6c..cadf7dc 100644 --- a/src/build.cc +++ b/src/build.cc @@ -520,7 +520,6 @@ void Plan::Dump() { printf("want "); i->first->Dump(); } - // TODO(iannucci): Dump pending pools too printf("ready: %d\n", (int)ready_.size()); } diff --git a/src/state.cc b/src/state.cc index b34b938..b0da350 100644 --- a/src/state.cc +++ b/src/state.cc @@ -35,7 +35,7 @@ void Pool::EdgeFinished(const Edge& edge) { void Pool::DelayEdge(Edge* edge) { assert(depth_ != 0); - delayed_.push(edge); + delayed_.push_back(edge); } void Pool::RetrieveReadyEdges(set* ready_queue) { @@ -43,12 +43,22 @@ void Pool::RetrieveReadyEdges(set* 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::const_iterator it = delayed_.begin(); + it != delayed_.end(); ++it) + { + printf("\t"); + (*it)->Dump(); + } +} + Pool State::kDefaultPool("", 0); const Rule State::kPhonyRule("phony"); @@ -188,4 +198,12 @@ void State::Dump() { node->status_known() ? (node->dirty() ? "dirty" : "clean") : "unknown"); } + if(!pools_.empty()) { + printf("resource_pools:\n"); + for (map::const_iterator it = pools_.begin(); + it != pools_.end(); ++it) + { + it->second->Dump(); + } + } } diff --git a/src/state.h b/src/state.h index 349679a..c28407f 100644 --- a/src/state.h +++ b/src/state.h @@ -16,7 +16,7 @@ #define NINJA_STATE_H_ #include -#include +#include #include #include #include @@ -56,6 +56,9 @@ struct Pool { /// Pool will add zero or more edges to the ready_queue void RetrieveReadyEdges(set* ready_queue); + /// Dump the Pool and it's edges (useful for debugging). + void Dump() const; + private: int UnitsWaiting() { return delayed_.size(); } @@ -64,7 +67,7 @@ private: int current_use_; int depth_; - queue delayed_; + deque delayed_; }; /// Global state (file status, loaded rules) for a single run. @@ -94,7 +97,7 @@ struct State { /// 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).