aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h')
-rw-r--r--tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h b/tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h
index fb7f65d7dc..074b8e57b0 100644
--- a/tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h
+++ b/tensorflow/tools/tfprof/internal/advisor/accelerator_utilization_checker.h
@@ -33,10 +33,11 @@ struct ExecStats {
class AcceleratorUtilizationChecker : public Checker {
public:
- string name() override { return "AcceleratorUtilizationChecker"; }
+ string name() const override { return kCheckers[0]; }
private:
- std::vector<string> Check(const TFStats* stats) override {
+ AdviceProto::Checker Check(const AdvisorOptionsProto::CheckerOption& options,
+ const TFStats* stats) override {
if (!stats) {
fprintf(stderr, "Missing profiles (e.g. graph, run_meta). Skip %s\n",
name().c_str());
@@ -48,24 +49,21 @@ class AcceleratorUtilizationChecker : public Checker {
return CheckInternal();
}
- std::vector<string> CheckInternal() {
+ AdviceProto::Checker CheckInternal() {
for (const auto& s : accelerator_exec_stats_) {
const ExecStats& stat = s.second;
int64 total_micros = stat.end_micros - stat.start_micros;
if (total_micros <= 0) continue;
double utilization = 1.0 * stat.exec_micros / total_micros;
if (utilization >= 0.5) {
- reports_.push_back(strings::Printf("%s: device: %s utilization: %.2f",
- kLevel[0], s.first.c_str(),
- utilization));
+ reports_.add_reports(strings::Printf("device: %s utilization: %.2f",
+ s.first.c_str(), utilization));
} else if (utilization < 0.5 && utilization > 0.2) {
- reports_.push_back(
- strings::Printf("%s: device: %s low utilization: %.2f", kLevel[1],
- s.first.c_str(), utilization));
+ reports_.add_reports(strings::Printf("device: %s low utilization: %.2f",
+ s.first.c_str(), utilization));
} else if (utilization <= 0.2) {
- reports_.push_back(
- strings::Printf("%s: device: %s low utilization: %.2f", kLevel[2],
- s.first.c_str(), utilization));
+ reports_.add_reports(strings::Printf("device: %s low utilization: %.2f",
+ s.first.c_str(), utilization));
}
}
return reports_;
@@ -102,7 +100,7 @@ class AcceleratorUtilizationChecker : public Checker {
std::map<string, ExecStats> accelerator_exec_stats_;
std::map<string, int64> ps_placement_;
- std::vector<string> reports_;
+ AdviceProto::Checker reports_;
};
} // namespace tfprof