gko::log::PerformanceHint#

Heuristic diagnostic logger that flags potentially-wasteful runtime patterns: cross-executor copies that look unintentional, repeated allocations of similarly-sized buffers, mismatched precisions in linked operations. Designed to be attached during development and removed for production runs.

class PerformanceHint #

Inherits from

PerformanceHint is a Logger which analyzes the performance of the application and outputs hints for unnecessary copies and allocations. The specific patterns it checks for are:

  • repeated cross-executor copies from or to the same pointer

  • repeated allocation/free pairs of the same size

Public Functions

void print_status() const#

Writes out the cross-executor writes and allocations that have been stored so far.

Public Static Functions

static inline std::unique_ptr<PerformanceHint> create(
std::ostream &os = std::cerr,
size_type allocation_size_limit = 16,
size_type copy_size_limit = 16,
size_type histogram_max_size = 1024,
)#

Creates a PerformanceHint logger. This dynamically allocates the memory, constructs the object and returns an std::unique_ptr to this object.

Parameters:
  • os – the stream used for this logger

  • allocation_size_limit – ignore allocations below this limit (bytes)

  • copy_size_limit – ignore copies below this limit (bytes)

  • histogram_max_size – how many allocation sizes and/or pointers to keep track of at most?

Returns:

an std::unique_ptr to the the constructed object