
Software Files
Altera provides the following software files for Nios
II systems. These files define the low-level access to
the hardware and provide control and reporting functions. Do not modify these files.
• altera_avalon_performance_counter.h, altera_avalon_performance_counter.c—The header and source code
for the functions and macros needed to control the performance counter core and retrieve raw results.
• perf_print_formatted_report.c—The source code for simple profile reporting.
Using the Performance Counter
In a Nios
II system, you can control the performance counter core with a set of highly efficient C macros,
and extract the results with C functions.
API Summary
The Nios
II application program interface (API) for the performance counter core consists of functions,
macros and constants.
Table 31-2: Performance Counter Macros and Functions
Name Summary
PERF_RESET() Stops and disables all counters, resetting them to 0.
PERF_START_MEASURING() Starts the global counter and enables section counters.
PERF_STOP_MEASURING() Stops the global counter and disables section counters.
PERF_BEGIN() Starts timing a code section.
PERF_END() Stops timing a code section.
perf_print_formatted_report() Sends a formatted summary of the profiling results to
stdout.
perf_get_total_time() Returns the aggregate global profiling time in clock
cycles.
perf_get_section_time() Returns the aggregate time for one section in clock
cycles.
perf_get_num_starts() Returns the number of counter events.
alt_get_cpu_freq() Returns the CPU frequency in Hz.
For a complete description of each macro and function, see the Performance counter API section.
Hardware Constants
You can get the performance counter hardware parameters from constants defined in system.h. The
constant names are based on the performance counter instance name, specified on the System Contents
tab in Qsys.
Table 31-3: Performance Counter Constants
Name (1) Meaning
PERFORMANCE_COUNTER_BASE Base address of core
31-4
Software Files
UG-01085
2014.24.07
Altera Corporation
Performance Counter Core
Send Feedback
Comentários a estes Manuais