How do I benchmark or count system cycles of a segemnt of code on the ADSP-CM40x ?

Document created by John_M Employee on Oct 14, 2013Last modified by John_M Employee on Oct 14, 2013
Version 3Show Document
  • View in full screen mode

// This example uses the ADSP-CM40X Enablement Software, available as a free download

 

/*=============  D A T A  =============*/

 

volatile Uint32_t data_a, data_b, data_c, data_d, data_e, data_f;   // Data variables

 

/*=============  C O D E  =============*/

 

CYCLES_INIT                                  // Initialize and enable system tick counter
CYCLES_CLR                                  // Clear system tick counter
 
data_a  = CYCLES_GET;                   // Get counter value
data_b  =    CYCLES_GET;                 // Get counter value
// Code of interest
. . .
. . .
// End of code of interest
data_c =    CYCLES_GET;                // Get counter value
data_d = data_b - data_a;                 // Calculate over head of read routines
data_e = data_c - data_b - data_d;   // Calculate system ticks or cycles to execute code of interest
// data_e is the number of cycles to execute code of interest

1 person found this helpful

Attachments

    Outcomes