diff options
author | surmeh01 <surabhi.mehta@arm.com> | 2018-05-18 16:31:43 +0100 |
---|---|---|
committer | telsoa01 <telmo.soares@arm.com> | 2018-05-23 13:09:07 +0100 |
commit | 3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0 (patch) | |
tree | 5950603ad78ec3fe56fb31ddc7f4d52a19f5bc60 /src/armnnUtils/HeapProfiling.hpp | |
parent | bceff2fb3fc68bb0aa88b886900c34b77340c826 (diff) | |
download | armnn-3537c2ca7ebf31c1673b9ec2bb0c17b0406bbae0.tar.gz |
Release 18.05
Diffstat (limited to 'src/armnnUtils/HeapProfiling.hpp')
-rw-r--r-- | src/armnnUtils/HeapProfiling.hpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/armnnUtils/HeapProfiling.hpp b/src/armnnUtils/HeapProfiling.hpp new file mode 100644 index 0000000000..febcbfe2b3 --- /dev/null +++ b/src/armnnUtils/HeapProfiling.hpp @@ -0,0 +1,47 @@ +// +// Copyright © 2017 Arm Ltd. All rights reserved. +// See LICENSE file in the project root for full license information. +// +#pragma once + +#ifdef ARMNN_HEAP_PROFILING_ENABLED + +#include <string> +#include <cstddef> + +// this is conditional so we can change the environment variable +// at build time +#ifndef ARMNN_HEAP_PROFILE_DUMP_DIR +#define ARMNN_HEAP_PROFILE_DUMP_DIR "ARMNN_HEAP_PROFILE_DUMP_DIR" +#endif // ARMNN_HEAP_PROFILE_DUMP_DIR + +namespace armnnUtils +{ +class ScopedHeapProfiler final +{ +public: + ScopedHeapProfiler(const std::string & tag); + ~ScopedHeapProfiler(); + +private: + // Location comes from the ARMNN_HEAP_PROFILE_DUMP_DIR + // if not available then it dumps to /tmp + std::string m_Location; + std::string m_Tag; + + // No default construction and copying + ScopedHeapProfiler() = delete; + ScopedHeapProfiler(const ScopedHeapProfiler &) = delete; + ScopedHeapProfiler & operator=(const ScopedHeapProfiler &) = delete; +}; + +} // namespace armnnUtils + +#define ARMNN_SCOPED_HEAP_PROFILING(TAG) \ + armnnUtils::ScopedHeapProfiler __scoped_armnn_heap_profiler__(TAG) + +#else // ARMNN_HEAP_PROFILING_ENABLED + +#define ARMNN_SCOPED_HEAP_PROFILING(TAG) + +#endif // ARMNN_HEAP_PROFILING_ENABLED |