diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-23 16:33:07 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-08-27 12:34:09 +0300 |
commit | 75b1e47f3a875517ff5ab4938025e1a200cb753f (patch) | |
tree | a63d197abbe7881a104bcb82b85885ebb45fd2f1 /render-test/allocation_index.hpp | |
parent | bf2924e858fb6a958c2463fa099c1bfb99eef70f (diff) | |
download | qtlocation-mapboxgl-75b1e47f3a875517ff5ab4938025e1a200cb753f.tar.gz |
[test runner] Introduce AllocationIndex
Diffstat (limited to 'render-test/allocation_index.hpp')
-rw-r--r-- | render-test/allocation_index.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/render-test/allocation_index.hpp b/render-test/allocation_index.hpp new file mode 100644 index 0000000000..42c8f3d4e7 --- /dev/null +++ b/render-test/allocation_index.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include <cstddef> + +class AllocationIndex { +public: + AllocationIndex() = delete; + /** + * @brief Starts/stops allocated memory indexing. + */ + static void setActive(bool); + /** + * @brief Returns memory indexing activity status. + */ + static bool isActive(); + /** + * @brief Resets the allocated memory index and all statistics data. + */ + static void reset(); + /** + * @brief Same as `malloc()` + indexes the allocated data, + * if indexing is active. + * + * @return void* + */ + static void* allocate(size_t); + /** + * @brief Same as `free()` + removes the corresponding data from index, + * if these data are present in the index and indexing is active. + * + * @return void* + */ + static void deallocate(void*) noexcept; + /** + * @brief Returns the size (in bytes) of allocated data, currently present in the index. + * + * @return size_t + */ + static size_t getAllocatedSize(); + /** + * @brief Returns the total amount of allocations since indexing start. + * + * @return size_t + */ + static size_t getAllocationsCount(); +};
\ No newline at end of file |