aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin May <kevin.may@arm.com>2020-04-24 10:21:40 +0100
committerKevin May <kevin.may@arm.com>2020-04-24 11:32:42 +0100
commit949a69ef997b1d78dca10b4cca833c3e6b3f5436 (patch)
tree759aafea2034843b693b4c342ffb22030bd70e39
parentd7be72ee37f5f4de1d981a400bf6d79b08ac0b2a (diff)
downloadandroid-nn-driver-949a69ef997b1d78dca10b4cca833c3e6b3f5436.tar.gz
IVGCVSW-4677 Refactor Timepoint duplication
Signed-off-by: Kevin May <kevin.may@arm.com> Change-Id: I6d37e7b8022ada1d875be01014babc5d31d07290
-rw-r--r--ArmnnPreparedModel_1_3.cpp18
-rw-r--r--ArmnnPreparedModel_1_3.hpp1
2 files changed, 6 insertions, 13 deletions
diff --git a/ArmnnPreparedModel_1_3.cpp b/ArmnnPreparedModel_1_3.cpp
index 6c4aec9..1fb03f4 100644
--- a/ArmnnPreparedModel_1_3.cpp
+++ b/ArmnnPreparedModel_1_3.cpp
@@ -390,15 +390,9 @@ Return<void> ArmnnPreparedModel_1_3<HalVersion>::executeFenced(const V1_3::Reque
Timing fenceTiming = g_NoTiming;
if (measureTiming == MeasureTiming::YES)
{
- TimePoint driverEnd = Now();
- timing.timeOnDevice = MicrosecondsDuration(ctx.deviceEnd, ctx.deviceStart);
- timing.timeInDriver = MicrosecondsDuration(driverEnd, ctx.driverStart);
- ALOGV("ArmnnPreparedModel_1_2::fenceExecutionTiming - Device = %lu Driver = %lu",
- timing.timeOnDevice, timing.timeInDriver);
-
fenceTiming.timeOnDevice = MicrosecondsDuration(ctx.deviceEnd, ctx.deviceStart);
- fenceTiming.timeInDriver = MicrosecondsDuration(driverEnd, fenceExecutionStart);
- ALOGV("ArmnnPreparedModel_1_2::fenceFinishExecutionTiming - Device = %lu Driver = %lu",
+ fenceTiming.timeInDriver = MicrosecondsDuration(ctx.driverEnd, fenceExecutionStart);
+ ALOGV("ArmnnPreparedModel_1_3::fenceFinishExecutionTiming - Device = %lu Driver = %lu",
fenceTiming.timeOnDevice, fenceTiming.timeInDriver);
}
@@ -671,8 +665,6 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::ExecuteGraph(
{
ALOGV("ArmnnPreparedModel_1_3::ExecuteGraph(...)");
- TimePoint driverEnd, deviceStart, deviceEnd;
-
DumpTensorsIfRequired("Input", inputTensors);
std::vector<OutputShape> outputShapes(outputTensors.size());
@@ -725,11 +717,11 @@ Return <V1_3::ErrorStatus> ArmnnPreparedModel_1_3<HalVersion>::ExecuteGraph(
if (cb.ctx.measureTimings == MeasureTiming::YES)
{
- driverEnd = Now();
+ cb.ctx.driverEnd = Now();
Timing timing;
timing.timeOnDevice = MicrosecondsDuration(cb.ctx.deviceEnd, cb.ctx.deviceStart);
- timing.timeInDriver = MicrosecondsDuration(driverEnd, cb.ctx.driverStart);
- ALOGV("ArmnnPreparedModel_1_2::execute timing - Device = %lu Driver = %lu", timing.timeOnDevice,
+ timing.timeInDriver = MicrosecondsDuration(cb.ctx.driverEnd, cb.ctx.driverStart);
+ ALOGV("ArmnnPreparedModel_1_3::execute timing - Device = %lu Driver = %lu", timing.timeOnDevice,
timing.timeInDriver);
cb.callback(V1_3::ErrorStatus::NONE, outputShapes, timing, "ArmnnPreparedModel_1_3::ExecuteGraph");
} else
diff --git a/ArmnnPreparedModel_1_3.hpp b/ArmnnPreparedModel_1_3.hpp
index fa67405..4dd15c1 100644
--- a/ArmnnPreparedModel_1_3.hpp
+++ b/ArmnnPreparedModel_1_3.hpp
@@ -29,6 +29,7 @@ struct ExecutionContext_1_3
::android::hardware::neuralnetworks::V1_2::MeasureTiming measureTimings =
::android::hardware::neuralnetworks::V1_2::MeasureTiming::NO;
TimePoint driverStart;
+ TimePoint driverEnd;
TimePoint deviceStart;
TimePoint deviceEnd;
};