26.07.2013 Views

Profiling Nios II Systems Application Note 391 - Altera

Profiling Nios II Systems Application Note 391 - Altera

Profiling Nios II Systems Application Note 391 - Altera

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Using Performance Counter and Timer Components Page 15<br />

Performance Counter Example with the <strong>Nios</strong> <strong>II</strong> Command Line<br />

This section describes how to create and run the performance counter software<br />

example with the <strong>Nios</strong> <strong>II</strong> command line.<br />

Creating the Performance Counter Software Example<br />

To create the profiler_performance_counter software project in the <strong>Nios</strong> <strong>II</strong> software<br />

build flow, follow these steps:<br />

1. Open a <strong>Nios</strong> <strong>II</strong> command shell as described in “Creating the Profiler Software<br />

Example” on page 7.<br />

2. Change to the /app/profiler_performance_counter<br />

directory.<br />

3. Create and build the application by typing the following command:<br />

./create-this-app r<br />

The create-this-app script runs the create-this-bsp script, which reads settings<br />

from the parameter_definition.tcl in<br />

/bsp/hal_profiler_performance_counter. This Tcl file<br />

contains the following lines:<br />

set_setting hal.sys_clk_timer peripheral_subsystem_sys_clk_timer<br />

set_setting hal.timestamp_timer peripheral_subsystem_high_res_timer<br />

set_setting hal.enable_gprof true<br />

set_setting hal.enable_exit true<br />

The first two lines set the system clock timer and timestamp timer to the<br />

corresponding timers in the Qsys system.<br />

The third line enables the GNU profiler, and the last line enable the alt_main()<br />

function to call exit() following main().<br />

Running the Performance Counter Software Example<br />

To run the application and collect the GNU profiler data, follow these steps:<br />

1. Open a second <strong>Nios</strong> <strong>II</strong> command shell.<br />

2. In the second shell, open a nios2-terminal session by typing the following<br />

command:<br />

nios2-terminal r<br />

3. In your original <strong>Nios</strong> <strong>II</strong> command shell, run the program by typing the following<br />

command:<br />

nios2-download -g *.elf r<br />

July 2011 <strong>Altera</strong> Corporation <strong>Profiling</strong> <strong>Nios</strong> <strong>II</strong> <strong>Systems</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!