Performance Estimation

In some cases, knowing the wall-clock time of the functions that may be turned into hardware functions may be necessary. You can accurately measure the execution time of functions by using special SDSoC API calls that measure activity based off of the free running clock of the Arm processor. The API functions include sds_clock_counter() and sds_clock_frequency(). These functions can be used to log the start and end times of a function. The function sds_clock_counter() returns the value of the free running clock register, while the function sds_clock_frequency() will return the speed in ticks/second of the Arm processor. Refer to SDSoC Environment API for more information on these functions.

Note: sds_clock_frequency() is a high performance counter and offers a fine-grained measurement of events.
A performance counter class is provided in the sds_util.h available with the SDSoC Examples on the Xilinx® GitHub repository. The perf_counter includes methods for capturing the start and stop clock times, and the number of function calls, as shown below:
#include "sds_lib.h"

class perf_counter
{
public:
     uint64_t tot, cnt, calls;
     perf_counter() : tot(0), cnt(0), calls(0) {};
     inline void reset() { tot = cnt = calls = 0; }
     inline void start() { cnt = sds_clock_counter(); calls++; };
     inline void stop() { tot += (sds_clock_counter() - cnt); };
     inline uint64_t avg_cpu_cycles() { return ((tot+(calls>>1)) / calls); };
};

You can also use the avg_cpu_cycles() method to return the equivalent number of average cycles the task took in CPU cycle count.