This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TMS570LC4357: TMS570LC4357

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

Hello,

I am using TMS570LC and  GIO Driver generated by HALCOGEN tool. I want to measure the performance of my algorithm in terms of cycles and time in micro seconds.

How can I measure cpu cyles and time and print the results.

Best,

Soundes.

  • Hello Soundes.,

    The ARM Cortex-R5F CPU has one PMU (performance monitoring unit). The PMU consists of three event counting registers, and those counting registers can be used to measure the performance of your algorithm.
  • Hello,

    I can't find any code example of that. 

    Best regards,

    Soundes.

  • Hello Soundes,

    The AHLCoGen generates functions for enabling, start/stop PMU: sys_pmu.asm

    1. enable PMU:
    / -- Measurement Initialization; want to measure how many cycles are used to receive data from nodes
    _pmuInit_();
    _pmuEnableCountersGlobal_();
    _pmuSetCountEvent_(pmuCOUNTER0, PMU_CYCLE_COUNT); // PMU_INST_ARCH_EXECUTED

    2. start PMU counter
    // -- Measurement Execution --
    _pmuResetCounters_();
    _pmuStartCounters_(pmuCOUNTER0);
    cycles_PMU_start = _pmuGetEventCount_(pmuCOUNTER0);

    3. code section

    4. Stop PMU
    _pmuStopCounters_(pmuCOUNTER0);
    cycles_PMU_end = _pmuGetEventCount_(pmuCOUNTER0);
    cycles_PMU_measure = cycles_PMU_end - cycles_PMU_start;
    seconds_PMU = cycles_PMU_measure / (CPU frequency);