advertisement
Profiling Execution Performance
About Profiling with the Nios II IDE
The GNU profiler (gprof) collects information about which functions call other functions during program execution, and tracks the time spent in each function. Profiling provides information about the efficiency of your program by showing you where and how your program spends its time.
Profiling can help you determine where to optimize your code to improve execution
performance.
The Profiling perspective in the Nios II IDE provides a convenient and useful way to analyze the GNU profiling data. The display features of the perspective's views make the data much easier to read and analyze, compared to reading the standard gprof text output.
Related Nios II IDE Help Topics
Profiling C Code
Profiling Perspective
Related Topics on the Web
AN 391: Profiling Nios II Systems at www.altera.com/literature/an/an391.pdf
The GNU Profiler —GNU gprof documentation from the Free Software Foundation
72
Profiling Execution Performance
Profiling C Code
To use the GNU profiler, you must compile and link your program with the profiling library, execute the program to generate a gmon.out profile data file, and run gprof to parse the profile data. The following sections describe how to accomplish the tasks.
To collect profiling data:
1. Switch to the Nios II C/C++ perspective, if necessary.
2. Right-click your project in the Nios II C/C++ Projects view, and then click System
Library Properties.
3. In the Properties dialog box, click System Library.
4. Turn on Link with profiling library.
5.
6. Click OK.
7. Right-click your project in the Nios II C/C++ Projects view, point to Run As, and then click Nios II Hardware.
After program execution completes, the file <project directory>/<build configuration
directory>/gmon.out contains the profiling information.
Note: Execution must return from main() to create the file; if you terminate the run or debug session, all profiling information is lost.
To analyze profiling data:
The nios2-elf-gprof utility converts the binary gmon.out data file and displays the profiling information in a readable format. You can run the nios2-elf-gprof utility automatically with the Profiling perspective in the Nios II IDE.
To view the profiling data, perform the following steps:
1. In the Nios II C/C++ Projects view, locate the generated gmon.out file in the
<build configuration directory> (typically Release or Debug) .
2. Double-click the gmon.out file to automatically switch to the Profiling perspective and display the gmon.out data.
You can also run the nios2-elf-gprof utility from the command line.
Related Nios II IDE Help Topics
About Profiling with the Nios II IDE
Profiling Perspective
Call Hierarchy View (Profiling Perspective)
Editor View (Profiling Perspective)
73
Nios II IDE Help System
Samples —Function Total View (Profiling Perspective)
Samples —Line By Line View (Profiling Perspective)
Related Topics on the Web
AN 391: Profiling Nios II Systems at www.altera.com/literature/an/an391.pdf
The GNU Profiler —GNU gprof documentation from the Free Software Foundation
74
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 5 About This Document
- 7 Welcome to the Nios II IDE
- 11 What's New in the Nios II IDE
- 14 Tutorials
- 14 About Tutorials
- 15 Creating a Nios II C/C++ Application Project
- 17 Building the Project
- 18 Running the Project
- 19 Running on Hardware
- 20 Running on the ISS
- 21 Debugging the Project
- 30 Editing the Project Properties
- 33 Creating Projects
- 33 About Nios II IDE Projects
- 35 About the Nios II IDE Managed-Make Build Environment
- 38 makefile
- 38 app.mk
- 39 system.mk
- 39 generated_all.mk
- 39 app_rules.mk
- 39 system_rules.mk
- 40 generated_app.mk
- 40 common.mk
- 40 component.mk
- 40 gnu_rules.mk
- 40 gtf_rules.mk
- 41 Creating a New Project
- 45 Importing, Exporting, and Sharing Projects and Files
- 49 Indexing and Searching Project Contents
- 50 Configuring Projects
- 50 About Project Properties
- 51 Configuring Project Properties
- 52 Choosing and Configuring an Operating System
- 54 Choosing and Configuring Software Packages
- 55 Configuring Project Dependencies
- 57 Editing Code
- 57 About Editing Code
- 58 Building Projects
- 58 About Building Projects
- 59 Building a Project
- 60 Running and Debugging Projects
- 60 About Running and Debugging Projects
- 63 Configuring the FPGA
- 65 Running and Debugging on Hardware
- 67 Running and Debugging on the ISS
- 69 Running on the ModelSim Simulator
- 70 Running and Debugging Multiprocessor Collections
- 72 Viewing Execution Trace
- 74 Viewing Disassembly
- 76 Profiling Execution Performance
- 76 About Profiling with the Nios II IDE
- 77 Profiling C Code
- 79 Storing Firmware on the Target Board
- 79 About Storing Firmware
- 80 Programming Flash
- 83 Features and Terms Reference
- 83 Advanced Debugging Features by FS2
- 84 C-to-Hardware Acceleration (C2H) Compiler
- 85 Hardware Abstraction Layer (HAL)
- 86 Hardware Simulation with ModelSim
- 87 Hardware Target
- 88 Host-Based File System
- 90 Instruction Set Simulator (ISS)
- 92 MicroC/OS-II RTOS
- 93 Multiprocessor Nios II Systems
- 94 NicheStack TCP/IP Stack - Nios II Edition
- 96 Run/Debug Configuration
- 97 Valid Project Names
- 98 Zip Read-Only File System
- 99 GUI Reference
- 99 Flash Programmer Dialog Box
- 102 Import Wizard
- 103 New Project Wizard
- 103 New Project Wizard
- 104 New Nios II C/C++ Application (New Project Wizard)
- 106 New Nios II System Library (New Project Wizard)
- 107 New Nios II C/C++ Library (New Project Wizard)
- 108 New Nios II User-Makefile C/C++ Application (New Project Wizard)
- 109 Nios II C/C++ Perspective
- 109 Nios II C/C++ Perspective
- 110 Preferences Dialog Box
- 110 Preferences Dialog Box
- 111 Nios II Page (Preferences Dialog Box)
- 112 New Projects Page (Preferences Dialog Box)
- 113 Trace Page (Preferences Dialog Box)
- 114 Profiling Perspective
- 114 Profiling Perspective
- 115 Project Properties Dialog Box
- 115 Properties Dialog Box
- 117 Associated System Library Page (Properties Dialog Box)
- 118 Builders Page (Properties Dialog Box)
- 119 C/C++ Build Page (Properties Dialog Box)
- 119 Tool Settings Tab
- 120 Error Parser Tab
- 120 Binary Parser Tab
- 120 Tool Settings Tab
- 121 Error Parser Tab
- 121 Binary Parser Tab
- 122 C/C++ Documentation Page (Properties Dialog Box)
- 123 Properties Dialog Box
- 125 Project References Page (Properties Dialog Box)
- 126 System Library Page (Properties Dialog Box)
- 130 RTOS Options Dialog Box (System Library Properties Page)
- 131 Software Components Dialog Box (System Library Properties Page)
- 132 Run/Debug Dialog Box
- 132 Run/Debug Dialog Box
- 134 Common Tab (Run/Debug Dialog Box)
- 135 Debugger Tab (Run/Debug Dialog Box)
- 137 ISS Settings Tab (Run/Debug Dialog Box)
- 139 Launch ModelSim Tab (Run Dialog Box)
- 140 Main Tab (Run/Debug Dialog Box)
- 142 Source Tab (Run/Debug Dialog Box)
- 143 Target Connection Tab (Run/Debug Dialog Box)
- 144 Views
- 144 Call Hierarchy View (Profiling Perspective)
- 145 Disassembly View (Debug Perspective)
- 146 Editor View (Profiling Perspective)
- 147 Nios II C/C++ Projects View (Nios II C/C++ Perspective)
- 151 Samples - Function Total View (Profiling Perspective)
- 152 Samples - Line By Line View (Profiling Perspective)
- 153 Trace View (Debug Perspective)
- 154 Workspace Launcher Dialog Box
- 155 Troubleshooting