aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/profiling
diff options
context:
space:
mode:
authorGravatar Shashi Shekhar <shashishekhar@google.com>2018-07-20 14:56:08 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-20 14:59:54 -0700
commit248980e6422f97aa44d6bbac942389f2e9de75ad (patch)
tree307bbac90f4d01afd42a3a48a8b236c8798add98 /tensorflow/contrib/lite/profiling
parent1711a9a08ce29029c66924f880fa1e619aed10aa (diff)
Fix a bug in stats updation and add a test.
PiperOrigin-RevId: 205458337
Diffstat (limited to 'tensorflow/contrib/lite/profiling')
-rw-r--r--tensorflow/contrib/lite/profiling/profile_summarizer.cc19
1 files changed, 3 insertions, 16 deletions
diff --git a/tensorflow/contrib/lite/profiling/profile_summarizer.cc b/tensorflow/contrib/lite/profiling/profile_summarizer.cc
index 36e87b666a..720bd717b9 100644
--- a/tensorflow/contrib/lite/profiling/profile_summarizer.cc
+++ b/tensorflow/contrib/lite/profiling/profile_summarizer.cc
@@ -23,8 +23,6 @@ namespace tflite {
namespace profiling {
namespace {
-using Detail = tensorflow::StatsCalculator::Detail;
-
struct OperatorDetails {
std::string name;
std::vector<std::string> inputs;
@@ -125,28 +123,17 @@ void ProfileSummarizer::ProcessProfiles(
int64_t base_start_us = events[0]->begin_timestamp_us;
int node_num = 0;
int64_t curr_total_us = 0;
- std::map<std::string, Detail> details;
for (auto event : events) {
auto op_details = GetOperatorDetails(interpreter, event->event_metadata);
auto node_name = ToString(op_details.outputs);
- auto result = details.emplace(node_name, Detail());
- Detail* detail = &(result.first->second);
- detail->start_us.UpdateStat(event->begin_timestamp_us - base_start_us);
+ int64_t start_us = event->begin_timestamp_us - base_start_us;
int64_t node_exec_time =
event->end_timestamp_us - event->begin_timestamp_us;
- detail->rel_end_us.UpdateStat(node_exec_time);
+ stats_calculator_->AddNodeStats(node_name, op_details.name, node_num,
+ start_us, node_exec_time, 0 /*memory */);
curr_total_us += node_exec_time;
++node_num;
-
- if (result.second) {
- detail->name = node_name;
- detail->type = op_details.name;
- detail->run_order = node_num;
- detail->times_called = 0;
- }
- ++detail->times_called;
}
- stats_calculator_->UpdateDetails(details);
stats_calculator_->UpdateRunTotalUs(curr_total_us);
}
} // namespace profiling