aboutsummaryrefslogtreecommitdiff
path: root/lib/arm_profiler/src/arm_profiler.cpp
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2021-05-21 18:59:18 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2021-05-24 20:11:33 +0200
commit44d6e22f953839a9e294a36d975289eac8615cf2 (patch)
tree0a4af87c4bd313e2f9d66228a9ab7551267a91ee /lib/arm_profiler/src/arm_profiler.cpp
parent596a4663da4a6ae4be6bb4cc7c80d6f98f4874bc (diff)
downloadethos-u-core-software-44d6e22f953839a9e294a36d975289eac8615cf2.tar.gz
Fixing compilation warnings
Change-Id: I3a1a361e6e8d40d2ac505b3c8d065c00224f1c2f
Diffstat (limited to 'lib/arm_profiler/src/arm_profiler.cpp')
-rw-r--r--lib/arm_profiler/src/arm_profiler.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/arm_profiler/src/arm_profiler.cpp b/lib/arm_profiler/src/arm_profiler.cpp
index c58037f..95bc3e4 100644
--- a/lib/arm_profiler/src/arm_profiler.cpp
+++ b/lib/arm_profiler/src/arm_profiler.cpp
@@ -28,7 +28,7 @@
namespace tflite {
-ArmProfiler::ArmProfiler(size_t max_events) : max_events_(max_events) {
+ArmProfiler::ArmProfiler(size_t max_events) : max_events_(max_events), num_events_(0) {
tags_ = std::make_unique<const char *[]>(max_events_);
start_ticks_ = std::make_unique<int32_t[]>(max_events_);
end_ticks_ = std::make_unique<int32_t[]>(max_events_);
@@ -39,9 +39,11 @@ uint32_t ArmProfiler::BeginEvent(const char *tag) {
tflite::GetMicroErrorReporter()->Report("Profiling event overflow, max: %u events", max_events_);
num_events_ = 0;
}
+
tags_[num_events_] = tag;
start_ticks_[num_events_] = GetCurrentTimeTicks();
end_ticks_[num_events_] = start_ticks_[num_events_] - 1;
+
return num_events_++;
}
@@ -54,9 +56,11 @@ void ArmProfiler::EndEvent(uint32_t event_handle) {
int32_t ArmProfiler::GetTotalTicks() const {
int32_t ticks = 0;
- for (int i = 0; i < num_events_; ++i) {
+
+ for (size_t i = 0; i < num_events_; ++i) {
ticks += end_ticks_[i] - start_ticks_[i];
}
+
return ticks;
}