diff options
-rw-r--r-- | src/build.cc | 10 | ||||
-rw-r--r-- | src/build_test.cc | 20 | ||||
-rw-r--r-- | src/graph.h | 14 | ||||
-rw-r--r-- | src/graph_test.cc | 4 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/build.cc b/src/build.cc index 1f1e153..04be16c 100644 --- a/src/build.cc +++ b/src/build.cc @@ -563,9 +563,9 @@ void Plan::ComputeCriticalTime(BuildLog* build_log) { // Add a bias to ensure that targets that appear first in |targets_| have a larger critical time than // those that follow them. E.g. for 3 targets: [2*total_time, total_time, 0]. int64_t priority_weight = (targets_.size() - i - 1) * total_time; - in->set_critical_time( + in->set_critical_time_ms( priority_weight + - std::max<int64_t>(in->run_time_ms(), in->critical_time())); + std::max<int64_t>(in->run_time_ms(), in->critical_time_ms())); if (!seen_edge(in)) { work_queue.push(in); } @@ -585,9 +585,9 @@ void Plan::ComputeCriticalTime(BuildLog* build_log) { continue; } // Only process edge if this node offers a higher critical time - const int64_t proposed_time = e->critical_time() + in->run_time_ms(); - if (proposed_time > in->critical_time()) { - in->set_critical_time(proposed_time); + const int64_t proposed_time = e->critical_time_ms() + in->run_time_ms(); + if (proposed_time > in->critical_time_ms()) { + in->set_critical_time_ms(proposed_time); if (!seen_edge(in)) { work_queue.push(in); } diff --git a/src/build_test.cc b/src/build_test.cc index 50a5394..e8518b4 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -491,11 +491,11 @@ TEST_F(PlanTest, PriorityWithoutBuildLog) { BuildLog log; PrepareForTarget("out", &log); - EXPECT_EQ(GetNode("out")->in_edge()->critical_time(), 1); - EXPECT_EQ(GetNode("a0")->in_edge()->critical_time(), 2); - EXPECT_EQ(GetNode("b0")->in_edge()->critical_time(), 2); - EXPECT_EQ(GetNode("c0")->in_edge()->critical_time(), 2); - EXPECT_EQ(GetNode("a1")->in_edge()->critical_time(), 3); + EXPECT_EQ(GetNode("out")->in_edge()->critical_time_ms(), 1); + EXPECT_EQ(GetNode("a0")->in_edge()->critical_time_ms(), 2); + EXPECT_EQ(GetNode("b0")->in_edge()->critical_time_ms(), 2); + EXPECT_EQ(GetNode("c0")->in_edge()->critical_time_ms(), 2); + EXPECT_EQ(GetNode("a1")->in_edge()->critical_time_ms(), 3); const int n_edges = 5; const char *expected_order[n_edges] = { @@ -548,11 +548,11 @@ TEST_F(PlanTest, PriorityWithBuildLog) { PrepareForTarget("out", &log); - EXPECT_EQ(GetNode("out")->in_edge()->critical_time(), 100); - EXPECT_EQ(GetNode("a0")->in_edge()->critical_time(), 110); - EXPECT_EQ(GetNode("b0")->in_edge()->critical_time(), 120); - EXPECT_EQ(GetNode("c0")->in_edge()->critical_time(), 150); - EXPECT_EQ(GetNode("a1")->in_edge()->critical_time(), 130); + EXPECT_EQ(GetNode("out")->in_edge()->critical_time_ms(), 100); + EXPECT_EQ(GetNode("a0")->in_edge()->critical_time_ms(), 110); + EXPECT_EQ(GetNode("b0")->in_edge()->critical_time_ms(), 120); + EXPECT_EQ(GetNode("c0")->in_edge()->critical_time_ms(), 150); + EXPECT_EQ(GetNode("a1")->in_edge()->critical_time_ms(), 130); const int n_edges = 5; const char *expected_order[n_edges] = { diff --git a/src/graph.h b/src/graph.h index 4fc34ca..0fab807 100644 --- a/src/graph.h +++ b/src/graph.h @@ -171,7 +171,7 @@ struct Edge { Edge() : rule_(NULL), pool_(NULL), dyndep_(NULL), env_(NULL), mark_(VisitNone), - id_(0), run_time_ms_(0), critical_time_(-1), outputs_ready_(false), + id_(0), run_time_ms_(0), critical_time_ms_(-1), outputs_ready_(false), deps_loaded_(false), deps_missing_(false), generated_by_dep_loader_(false), implicit_deps_(0), order_only_deps_(0), implicit_outs_(0) {} @@ -201,9 +201,9 @@ struct Edge { // forming the longest time-weighted path to the target output. // This quantity is used as a priority during build scheduling. // NOTE: Defaults to -1 as a marker smaller than any valid time - int64_t critical_time() const { return critical_time_; } - void set_critical_time(int64_t critical_time) { - critical_time_ = critical_time; + int64_t critical_time_ms() const { return critical_time_ms_; } + void set_critical_time_ms(int64_t critical_time_ms) { + critical_time_ms_ = critical_time_ms; } // Run time in ms for this edge's command. @@ -224,7 +224,7 @@ struct Edge { VisitMark mark_; size_t id_; int64_t run_time_ms_; - int64_t critical_time_; + int64_t critical_time_ms_; bool outputs_ready_; bool deps_loaded_; bool deps_missing_; @@ -393,8 +393,8 @@ struct DependencyScan { // how all tasks were scheduled. struct EdgePriorityLess { bool operator()(const Edge* e1, const Edge* e2) const { - const int64_t ct1 = e1->critical_time(); - const int64_t ct2 = e2->critical_time(); + const int64_t ct1 = e1->critical_time_ms(); + const int64_t ct2 = e2->critical_time_ms(); if (ct1 != ct2) { return ct1 < ct2; } diff --git a/src/graph_test.cc b/src/graph_test.cc index d657387..c7efec3 100644 --- a/src/graph_test.cc +++ b/src/graph_test.cc @@ -965,7 +965,7 @@ TEST_F(GraphTest, EdgeQueuePriority) { // Output is largest critical time to smallest for (int i = 0; i < n_edges; ++i) { - edges[i]->set_critical_time(i * 10); + edges[i]->set_critical_time_ms(i * 10); } EdgePriorityQueue queue; @@ -982,7 +982,7 @@ TEST_F(GraphTest, EdgeQueuePriority) { // When there is ambiguity, the lowest edge id comes first for (int i = 0; i < n_edges; ++i) { - edges[i]->set_critical_time(0); + edges[i]->set_critical_time_ms(0); } queue.push(edges[1]); |