Product SiteDocumentation Site

20.6.2. Using opreport on a Single Executable

To retrieve more detailed profiled information about a specific executable, use the opreport command:
~]# opreport mode executable
Replace executable with the full path to the executable to be analyzed. mode stands for one of the following options:
-l
This option is used to list sample data by symbols. For example, running this command:
~]# opreport -l /lib/tls/libc-version.so
produces the following output:
samples % symbol name 
12 21.4286 __gconv_transform_utf8_internal 
5 8.9286 _int_malloc 4 7.1429 malloc 
3 5.3571 __i686.get_pc_thunk.bx 
3 5.3571 _dl_mcount_wrapper_check 
3 5.3571 mbrtowc 
3 5.3571 memcpy 
2 3.5714 _int_realloc 
2 3.5714 _nl_intern_locale_data 
2 3.5714 free 
2 3.5714 strcmp 
1 1.7857 __ctype_get_mb_cur_max 
1 1.7857 __unregister_atfork 
1 1.7857 __write_nocancel 
1 1.7857 _dl_addr 
1 1.7857 _int_free 
1 1.7857 _itoa_word 
1 1.7857 calc_eclosure_iter 
1 1.7857 fopen@@GLIBC_2.1 
1 1.7857 getpid 
1 1.7857 memmove 
1 1.7857 msort_with_tmp 
1 1.7857 strcpy 
1 1.7857 strlen 
1 1.7857 vfprintf 
1 1.7857 write
The first column is the number of samples for the symbol, the second column is the percentage of samples for this symbol relative to the overall samples for the executable, and the third column is the symbol name.
To sort the output from the largest number of samples to the smallest (reverse order), use -r in conjunction with the -l option.
-i symbol-name
List sample data specific to a symbol name. For example, running:
~]# opreport -l -i __gconv_transform_utf8_internal /lib/tls/libc-version.so
returns the following output:
samples % symbol name 
12 100.000 __gconv_transform_utf8_internal
The first line is a summary for the symbol/executable combination.
The first column is the number of samples for the memory symbol. The second column is the percentage of samples for the memory address relative to the total number of samples for the symbol. The third column is the symbol name.
-d
This option lists sample data by symbols with more detail than the -l option. For example, with the following command:
~]# opreport -d -i __gconv_transform_utf8_internal /lib/tls/libc-version.so
this output is returned:
vma samples % symbol name 
00a98640 12 100.000 __gconv_transform_utf8_internal 
00a98640 1 8.3333 
00a9868c 2 16.6667 
00a9869a 1 8.3333 
00a986c1 1 8.3333 
00a98720 1 8.3333 
00a98749 1 8.3333 
00a98753 1 8.3333 
00a98789 1 8.3333 
00a98864 1 8.3333 
00a98869 1 8.3333 
00a98b08 1 8.3333
The data is the same as the -l option except that for each symbol, each virtual memory address used is shown. For each virtual memory address, the number of samples and percentage of samples relative to the number of samples for the symbol is displayed.
-e symbol-name
With this option, you can exclude some symbols from the output. Replace symbol-name with the comma-separated list of symbols you want to exclude.
session:name
Here, you can specify the full path to the session, a directory relative to the /var/lib/oprofile/samples/ directory, or if you are using operf, a directory relative to ./oprofile_data/samples/.