6 Working With gprofng
and Threaded Applications
Collect performance data for multithreaded applications.
By default, the performance data for a multithreaded application is aggregated over all threads. If the data for individual threads, or a set of threads, is needed, then filters can be used to analyze that information.
To list all the threads for which performance data has been captured, use the -thread_list
and -threads
options:
gprofng display text -thread_list -threads experiment-directory-name.er
Exp Sel Total
=== === =====
1 all 3
Objects sorted by metric: Exclusive Total CPU Time
Excl. Total Name
CPU
sec. %
5.775 100.00 <Total>
2.773 48.01 Process 1, Thread 3
2.722 47.13 Process 1, Thread 2
0.280 4.85 Process 1, Thread 1
In the example output you can see that the CPU times for three threads were used during that experiment. The thread number can be used to review information for both a specific thread or a group of threads.
To review the performance data for a specific thread, use the
-thread_select
option with a thread number:
gprofng display text -limit 5 -thread_select 1 -functions experiment-directory-name.er
Print limit set to 5
Exp Sel Total
=== === =====
1 1 3
Functions sorted by metric: Exclusive Total CPU Time
Excl. Total Incl. Total Name
CPU CPU
sec. % sec. %
0.280 100.00 0.280 100.00 <Total>
0.126 44.84 0.267 95.37 init_data
0.068 24.20 0.104 37.01 erand48_r
0.038 13.52 0.142 50.53 drand48
0.036 12.81 0.036 12.81 __drand48_iterate