Skip to content

Commit

Permalink
logging if NN eval duration > 1s
Browse files Browse the repository at this point in the history
calculating time elapsed before NN eval -> after NN eval and logging a message if time elapsed > 1s
  • Loading branch information
KarlKfoury authored Aug 29, 2024
1 parent 0c65aa6 commit a6b5d3a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/neural/network_tf_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,15 @@ class TFNetworkComputation : public NetworkComputation {
raw_input_.emplace_back(input);
}
void ComputeBlocking() override {
auto start_time = std::chrono::high_resolution_clock::now();
PrepareInput();
status_ = network_->Compute(input_, &output_);
CHECK(status_.ok()) << status_.ToString();
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = end_time - start_time;
if (elapsed.count() > 1.0) {
std::cerr << "Warning: Computation took " << elapsed.count() << " seconds, which is longer than expected." << std::endl;
}
}

int GetBatchSize() const override { return raw_input_.size(); }
Expand Down

0 comments on commit a6b5d3a

Please sign in to comment.