このページでは

C

パフォーマンス・メトリクス・プラットフォームAPIの実装

Qul::Platform::PerformanceMetrics 構造から派生し、最大ヒープ使用量、最大スタック使用量、および CPU 負荷の仮想関数をオーバーライドします。使用するプ ラ ッ ト フ ォームのパフ ォーマ ン ス メ ト リ ッ ク 用のカ ス タ ム実装を作成 し ます:

struct ExamplePerformanceMetrics : PerformanceMetrics
{
    uint64_t maxHeapUsage() QUL_DECL_OVERRIDE
    {
        /*Custom maximum heap usage 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;
    }
#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
};

ExamplePerformanceMetrics 構造体からQt Quick Ultralite Core へのアクセスを提供するために、この情報を返すようにPlatformContext::performanceMetrics をプラットフォーム・コンテキストに実装します。

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

メモリー統計

プラットフォームはヒープやスタックサイズのようなメモリ統計を取得する関数を提供します。

このような情報を表示するには、Qul::Platform::printHeapStatsQul::Platform::printStackStats 関数を実装する必要があります。あなたのプラットフォームでmallinfo() 関数が利用できるなら、それを使ってもよい。

IAR
void printHeapStats(void)
{
    struct mallinfo mi = mallinfo();
    PlatformInterface::log("Heap: %u/%u (in-use/total)\r\n", mi.uordblks, mi.arena);
}

void printStackStats(void)
{
    // Replace this with actual measuring for your platform
    uint32_t maxUsedStackSize = 0;
    PlatformInterface::log("Stack: %u (peak)\r\n", maxUsedStackSize);
}
void printHeapStats(void)
{
    struct mallinfo mi = __iar_dlmallinfo();
    PlatformInterface::log("Heap: %u/%u (in-use/total)\r\n", mi.uordblks, mi.arena);
}

void printStackStats(void)
{
    // Replace this with actual measuring for your platform
    uint32_t maxUsedStackSize = 0;
    PlatformInterface::log("Stack: %u (peak)\r\n", maxUsedStackSize);
}

特定の Qt ライセンスの下で利用可能です。
詳細はこちら。