5 #ifndef GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_
6 #define GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_
11 #include <unordered_map>
14 #include <ginkgo/core/log/logger.hpp>
34 const uintptr& location)
const override;
37 const uintptr& location)
const override;
42 const size_type& num_bytes)
const override;
62 static std::unique_ptr<PerformanceHint>
create(
63 std::ostream& os = std::cerr,
size_type allocation_size_limit = 16,
67 os, allocation_size_limit, copy_size_limit, histogram_max_size));
76 allocation_size_limit_{allocation_size_limit},
77 copy_size_limit_{copy_size_limit},
78 histogram_max_size_{histogram_max_size}
83 std::ostream& log()
const;
86 mutable std::unordered_map<uintptr_t, size_type> allocation_sizes_;
87 mutable std::unordered_map<size_type, int> allocation_histogram_;
88 mutable std::unordered_map<uintptr_t, int> copy_src_histogram_;
89 mutable std::unordered_map<uintptr_t, int> copy_dst_histogram_;
93 static constexpr Logger::mask_type mask_ =
94 Logger::allocation_completed_mask | Logger::free_completed_mask |
95 Logger::copy_completed_mask;
96 static constexpr
const char* prefix_ =
"[PERFORMANCE] >>> ";
104 #endif // GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_