Analyzing Thread Usage of C/C++/Fortran Applications
See Also
The Thread Usage profiling tool runs by default for C, C++, and Fortran projects,
and shows the number of threads in use by your program. You can use it to observe
any moments where a thread has to wait to get a lock in order to proceed with its task.
This data is useful for multithreaded applications, which must perform thread synchronization
in order to avoid expensive wait times.
Note: The profiling tools are supported only on platforms shown in
Overview of C and C++ Profiling.
The Thread Usage indicator graphically shows the total number of threads running in the program
and the number of threads that are waiting. The Thread Usage indicator is available in all
Profile Configurations.
To view more detailed information about thread usage:
- In the Run Monitor window, click the Sync Problems button to open the Thread Synchronization Details tab to display
a list of the functions that have synchronization problems. The problem spots
are listed as function-name at filename:line, with the number of seconds spent waiting
and the number of times the thread waited for a lock while executing the function.
- Click a column heading to sort the list of functions using the information in that column.
- Double-click functions shown in bold to open the source files where they are called. Numbers
displayed in the left margin are the memory leak metrics for that function.
- Use the Time Filter controls in the Thread Synchronization Details tab to specify Start and End times to select a particular
time period of the run time to look at. You can also use the orange controls in the Run Monitor window
to select the time period.
If you see a message that detailed information is not available in the current profile configuration:
- Right-click the project and select Properties.
- Click the Profile node in the Project Properties dialog.
- In the Profile Configuration list, select one of the C/C++ DTrace Standard configuration
if you are running on Oracle Solaris, or C/C++ Oracle Solaris Studio Standard if you are running
on Linux with the Oracle Solaris Studio tool collection.
Tip: If you do not see these configurations, your operating system and tool collection
do not support the advanced profiling features.
- Click OK.
- Run the project and you should be able to click the Sync Problems button and see detailed
information.
To disable Thread Usage profiling in the Run Monitor:
- Modify an existing profile configuration to deselect the Thread Usage tool. For information
about modifying a profile configuration, see
Managing Profile Configurations.
To disable all Run Monitor profiling tools:
Legal Notices