Performance Handler

Overview of Performance Handler

During the initialization of Prysm’s Library you can set your own object to LibraryParams::PerformanceHandler which implements Profile::IPerformanceHandler interface. Its purpose is to provide additional information to the developers when there is a performance hit in the UI and receive some guidelines how to reduce it.

For example, if the UI has reached the maximum of temporary texture cache you’ll receive a message:

One approach here is to check which elements are responsible for more scratch textures creation and try to optimize it. The other option is to increase the cache size.

class PerformanceHandler : public cohtml::Profile::IPerformanceHandler
{

public:
	virtual void WriteLog(const char* message, size_t /*length*/) override
	{
		// Apply text colorize if it's needed
		std::cout << "Performance Warning" << ": " << message << std::endl;
	}
};

cohtml::Profile::IPerformanceHandler* gPerfHandler;

{
	gPerfHandler = new PerformanceHandler();

	... Library's initialization
	LibraryParams params;
	params.LoggingSeverity = optionsCopy.LogVerbosity; // What logging messages we want to receive
	params.LogHandler = gLogger;
	params.PerformanceHandler = gPerfHandler;
	....
}