5 #ifndef GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_
6 #define GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_
11 #include <unordered_map>
13 #include <ginkgo/core/log/logger.hpp>
33 const uintptr& location)
const override;
36 const uintptr& location)
const override;
41 const size_type& num_bytes)
const override;
61 static std::unique_ptr<PerformanceHint>
create(
62 std::ostream& os = std::cerr,
size_type allocation_size_limit = 16,
66 os, allocation_size_limit, copy_size_limit, histogram_max_size));
75 allocation_size_limit_{allocation_size_limit},
76 copy_size_limit_{copy_size_limit},
77 histogram_max_size_{histogram_max_size}
82 std::ostream& log()
const;
85 mutable std::unordered_map<uintptr_t, size_type> allocation_sizes_;
86 mutable std::unordered_map<size_type, int> allocation_histogram_;
87 mutable std::unordered_map<uintptr_t, int> copy_src_histogram_;
88 mutable std::unordered_map<uintptr_t, int> copy_dst_histogram_;
92 static constexpr Logger::mask_type mask_ =
93 Logger::allocation_completed_mask | Logger::free_completed_mask |
94 Logger::copy_completed_mask;
95 static constexpr
const char* prefix_ =
"[PERFORMANCE] >>> ";
103 #endif // GKO_PUBLIC_CORE_LOG_PERFORMANCE_HINT_HPP_