C

Implementing performance metrics platform APIs

Derive from the Qul::Platform::PerformanceMetrics structure and override the virtual functions for current heap usage, maximum heap usage, total heap size, maximum stack usage, total stack size, and CPU load. Some platforms might also provide extra metrics by implementing the PerformanceMetrics::printExtraMetrics function. Create a custom implementation for the performance metrics for your platform:

struct ExamplePerformanceMetrics : PerformanceMetrics
{
    uint64_t heapUsage() QUL_DECL_OVERRIDE
    {
        /*Custom heap usage function depending on Platform and toolchains.*/
        return 0;
    }
    uint64_t maxHeapUsage() QUL_DECL_OVERRIDE
    {
        /*Custom maximum heap usage function depending on Platform and toolchains.*/
        return 0;
    }
    uint64_t heapSize() QUL_DECL_OVERRIDE
    {
        /*Custom heap total size function depending on Platform and toolchains.*/
        return 0;
    }
    uint64_t maxStackUsage() QUL_DECL_OVERRIDE
    {
        /*Custom maximum stack usage function depending on Platform and toolchains.*/
        return 0;
    }
    uint64_t stackSize() QUL_DECL_OVERRIDE
    {
        /*Custom stack total size function depending on Platform and toolchains.*/
        return 0;
    }
#if defined(QUL_ENABLE_HARDWARE_PERFORMANCE_LOGGING)
    float cpuLoad() QUL_DECL_OVERRIDE
    {
        /*Custom CPU load measurement function depending on Platform and toolchains.*/
        return 0.f;
    };
#endif
    void printExtraMetrics() QUL_DECL_OVERRIDE{
        /*Custom function to print platform specific performance metrics depending on Platform and toolchains.*/
    };
};

Implement PlatformContext::performanceMetrics in your platform context to return this information to provide the ExamplePerformanceMetrics structure access to the Qt Quick Ultralite Core.

Platform::PerformanceMetrics *ExamplePlatform::performanceMetrics(void)
{
    static ExamplePerformanceMetrics metrics;
    return &metrics;
}

Available under certain Qt licenses.
Find out more.