5 #ifndef OPENCV_CORE_ALLOCATOR_STATS_IMPL_HPP
6 #define OPENCV_CORE_ALLOCATOR_STATS_IMPL_HPP
8 #include "./allocator_stats.hpp"
14 #ifndef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
15 #if defined(__GNUC__) && (\
16 (defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 4) || \
17 (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)) \
19 #define OPENCV_ALLOCATOR_STATS_COUNTER_TYPE int
23 #ifndef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
24 #define OPENCV_ALLOCATOR_STATS_COUNTER_TYPE long long
27 namespace cv {
namespace utils {
29 #ifdef CV__ALLOCATOR_STATS_LOG
35 #ifdef OPENCV_DISABLE_ALLOCATOR_STATS
55 typedef OPENCV_ALLOCATOR_STATS_COUNTER_TYPE
counter_t;
72 #ifdef CV__ALLOCATOR_STATS_LOG
73 CV__ALLOCATOR_STATS_LOG(
cv::format(
"allocate: %lld (curr=%lld)", (
long long int)sz, (
long long int)
curr.
load()));
80 while (prev_peak < new_curr)
92 #ifdef CV__ALLOCATOR_STATS_LOG
93 CV__ALLOCATOR_STATS_LOG(
cv::format(
"free: %lld (curr=%lld)", (
long long int)sz, (
long long int)
curr.
load()));
100 #ifdef CV__ALLOCATOR_STATS_LOG
Definition: allocator_stats.hpp:13
Definition: allocator_stats.impl.hpp:34
std::atomic< counter_t > total
Definition: allocator_stats.impl.hpp:56
std::atomic< counter_t > total_allocs
Definition: allocator_stats.impl.hpp:56
uint64_t getTotalUsage() const CV_OVERRIDE
Definition: allocator_stats.impl.hpp:62
void onAllocate(size_t sz)
Definition: allocator_stats.impl.hpp:70
uint64_t getCurrentUsage() const CV_OVERRIDE
Definition: allocator_stats.impl.hpp:61
AllocatorStatistics()
Definition: allocator_stats.impl.hpp:58
std::atomic< counter_t > peak
Definition: allocator_stats.impl.hpp:56
uint64_t getPeakUsage() const CV_OVERRIDE
Definition: allocator_stats.impl.hpp:64
void onFree(size_t sz)
Definition: allocator_stats.impl.hpp:90
uint64_t getNumberOfAllocations() const CV_OVERRIDE
Definition: allocator_stats.impl.hpp:63
void resetPeakUsage() CV_OVERRIDE
Definition: allocator_stats.impl.hpp:67
~AllocatorStatistics() CV_OVERRIDE
Definition: allocator_stats.impl.hpp:59
OPENCV_ALLOCATOR_STATS_COUNTER_TYPE counter_t
Definition: allocator_stats.impl.hpp:55
std::atomic< counter_t > curr
Definition: allocator_stats.impl.hpp:56
T compare_exchange_weak(T... args)
#define CV_OVERRIDE
Definition: cvdef.h:792
CV_EXPORTS String format(const char *fmt,...) CV_FORMAT_PRINTF(1
Returns a text string formatted using the printf-like expression.
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441