General information
QNX Momentics Professional Edition (PE) based on the Eclipse platform is a full-featured and highly integrated professional developer kit that contains everything you need to build and optimize applications for the QNX Neutrino RTOS. With a wide range of handy tools — from embedding on a processor board to remote diagnostics — QNX Momentics PE provides a single, flexible software environment for the entire development cycle.
Profiling programs provides a simple and convenient mechanism for researching the execution of a program in order to optimize it.
Profiling is a collection of program performance characteristics, such as the execution time of individual program fragments, the number of correctly predicted conditional transitions, etc. The tool used to analyze work is called a
profiler .
')
In this
step -by-
step guide, we profile the sy21 training, multithreaded application using the
QNX System Profiler and
QNX Application Profiler tools to demonstrate the capabilities of the profiling tools in QNX Momentics.
Many pictures
The Profiler of the Profiler shows the execution time of individual program fragments, allows you to see the amount of time that the program spends on each line and each function.
The System Profiler profiler goes beyond conventional debuggers and code analyzers, it is a graphical system analysis tool, allowing you to explore how all the components of a complex real-time system interact with each other. The result is additional convenience for users in terms of finding errors and optimizing code, as well as increasing the speed of work and greater predictability of the systems themselves.
The
sy21 multithreaded application built on semaphores (Semaphore is an object that allows no more than n streams to enter a given code segment) illustrates the work of thread synchronization, within the framework of this guide it will allow to better demonstrate the work of the profiler.
Training
To work with this guide, you will need:
- QNX Momentics, to compile the application and perform the profiling itself (the manual uses the latest version, 6.5, but the profiling tools are available from earlier versions)
- Installed QNX Neutrino to run the compiled application (the manual uses the VMware Workstation virtual machine)
- Average knowledge of C ++
Profiling
In QNX Momentics we will create a new QNX C ++ project, set the configuration in the
Buld Variants tab
The project has been created, now we will compile the application
Project-> Build Project , with successful compilation in the console window we will see the following
Create a
C / C ++ QNX QConn (ip) configuration for running the program
run-> run configurations
In the
C / C ++ Aplication field, select our project.
In the
Target Options field, write the ip address of the running QNX Neutrino OS
The ip address can be found by running the terminal in the operating system, using the
ifconfig command, to monitor the processes at a momentics, you must run the target
qconn agent
Go to the arguments tab of the program being executed, run the program with arguments
-n20 -t2 , n is the number of iterations of the synchronization cycle (control transfer), t is the number of threads between which synchronization is performed
Now create a profiler configuration:
Run the generated profiler configuration, while it is running, run our program for execution. Open the created log, to do this, go to the QNX System Profiler tab and open the log (file with kev extension)
General information:
CPU load:
Graphical representation of the interaction of processes and threads:
Consider more. Find our process and take a closer look.
Creating the first child thread:
Sync cycle:
Now go to the QNX Aplication Profiler tab.
here you can see the total execution time of individual as individual functions and threads.
Also, if you go to the QNX System information tab, you can view the status of a running operating system.
Running processes:
Information about the selected process:
Memory Information:
File system:
In this tutorial, we will not optimize anything, as it was written to demonstrate profiling tools.
Literature
- Anatomy of parallelism - Oleg Tsiryulik, Egor Goroshko
- QNX Momentics Basics - Sergey Zyl