Performance Handler
On this page
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:
“Layer Textures cache is being pruned! This might cause layer texture creation in next frames.".
Messages received in
Profile::IPerformanceHandler::WriteLog
are rather notifications than critical. In other words this interface appears as an addition to Prysm’s logging system.The implementation of this interface is not mandatory. If you don’t need such type of logs you may leave the
LibraryParams::PerformanceHandler
as it is.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;
....
}