Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

4.4.4.5. Performance Counter Software Considerations

You must use the PERF_BEGIN and PERF_END performance counter macros to record the beginning and ending times of each measured section.

PERF_BEGIN and PERF_END are single writes to the performance counter component. These macros are very efficient, requiring only two or three machine instructions.

The example below shows the PERF_BEGIN and PERF_END performance counter macros in altera_avalon_performance_counter.h:

PERF_BEGIN and PERF_END Performance Counter Macros in altera_avalon_performance_counter.h

#define PERF_BEGIN(p,n) IOWR((p),(((n)*4)+1),0)

#define PERF_END(p,n) IOWR((p),(((n)*4) ),0)