diff options
author | Kristofer Jonsson <kristofer.jonsson@arm.com> | 2022-02-10 14:17:24 +0100 |
---|---|---|
committer | Kristofer Jonsson <kristofer.jonsson@arm.com> | 2022-02-10 14:19:26 +0100 |
commit | a78c7a87ea8f91008bff7779bfea30fcb10b3095 (patch) | |
tree | f5d3a733bd82e2270a3f044d2f02d018b2334ab8 /lib | |
parent | 5adf5a6d0bbfa36d4a757f211ae6b4a5c9e51dac (diff) | |
download | ethos-u-core-software-a78c7a87ea8f91008bff7779bfea30fcb10b3095.tar.gz |
For larger networks the GetTotalTicks() might overflow if the function
returns int32_t. GetTotalTicks() is a non virtual function that can
be overridden with a different return type in the implementation class.
Change-Id: I8dd2e448fd13e0823fe1e5f9cc335998d2806416
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arm_profiler/include/arm_profiler.hpp | 4 | ||||
-rw-r--r-- | lib/arm_profiler/src/arm_profiler.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/arm_profiler/include/arm_profiler.hpp b/lib/arm_profiler/include/arm_profiler.hpp index 36adb8d..0b97e2e 100644 --- a/lib/arm_profiler/include/arm_profiler.hpp +++ b/lib/arm_profiler/include/arm_profiler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. All rights reserved. + * Copyright (c) 2021-2022 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -30,7 +30,7 @@ public: ArmProfiler(size_t max_events = 200); uint32_t BeginEvent(const char *tag); void EndEvent(uint32_t event_handle); - int32_t GetTotalTicks() const; + uint64_t GetTotalTicks() const; private: size_t max_events_; diff --git a/lib/arm_profiler/src/arm_profiler.cpp b/lib/arm_profiler/src/arm_profiler.cpp index 95bc3e4..c90eec2 100644 --- a/lib/arm_profiler/src/arm_profiler.cpp +++ b/lib/arm_profiler/src/arm_profiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Arm Limited. All rights reserved. + * Copyright (c) 2021-2022 Arm Limited. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -54,8 +54,8 @@ void ArmProfiler::EndEvent(uint32_t event_handle) { "%s : cycle_cnt : %u cycles", tags_[event_handle], end_ticks_[event_handle] - start_ticks_[event_handle]); } -int32_t ArmProfiler::GetTotalTicks() const { - int32_t ticks = 0; +uint64_t ArmProfiler::GetTotalTicks() const { + uint64_t ticks = 0; for (size_t i = 0; i < num_events_; ++i) { ticks += end_ticks_[i] - start_ticks_[i]; |