JavaScript is required to for searching.
跳过导航链接
退出打印视图
Oracle Solaris Studio 12.3:性能分析器     Oracle Solaris Studio 12.3 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  性能分析器概述

2.  性能数据

3.  收集性能数据

4.  性能分析器工具

5.  er_print 命令行性能分析工具

er_print 语法

度量列表

控制函数列表的命令

functions

metrics metric_spec

sort metric_spec

fsummary

fsingle function_name [N]

控制调用方-被调用方列表的命令

callers-callees

csingle function_name [N]

cprepend function-name [N | ADDR]

cappend function-name [N | ADDR]

crmfirst

crmlast

控制调用树列表的命令

calltree

控制泄漏和分配列表的命令

leaks

allocs

控制源代码和反汇编代码列表的命令

pcs

psummary

lines

lsummary

source|src { filename | function_name } [ N]

disasm|dis { filename | function_name } [ N]

scc com_spec

sthresh value

dcc com_spec

dthresh value

cc com_spec

控制源文件搜索的命令

setpath path_list

addpath path_list

pathmap old-prefix new-prefix

控制硬件计数器数据空间和内存对象列表的命令

data_objects

data_single name [N]

data_layout

memobj mobj_type

mobj_list

mobj_define mobj_type index_exp

控制索引对象列表的命令

indxobj indxobj_type

indxobj_list

indxobj_define indxobj_type index_exp

用于 OpenMP 索引对象的命令

OMP_preg

OMP_task

支持线程分析器的命令

races

rdetail race_id

deadlocks

ddetail deadlock_id

列出实验、抽样、线程和 LWP 的命令

experiment_list

sample_list

lwp_list

thread_list

cpu_list

控制实验数据过滤的命令

指定过滤表达式

filters filter_exp

列出过滤器表达式的关键字

describe

选择要进行过滤的抽样、线程、LWP 和 CPU

选择列表

选择命令

sample_select sample_spec

lwp_select lwp_spec

thread_select thread_spec

cpu_select cpu_spec

控制装入对象展开和折叠的命令

object_list

object_show object1,object2,...

object_hide object1,object2,...

object_api object1,object2,...

objects_default

object_select object1,object2,...

列出度量的命令

metric_list

cmetric_list

data_metric_list

indx_metric_list

控制输出的命令

outfile {filename|-|--}

appendfile 文件名

limit n

name { long | short } [ :{ shared_object_name | no_shared_object_name } ]

viewmode { user| expert | machine }

compare { on | off }

列显其他信息的命令

header exp_id

ifreq

objects

overview exp_id

statistics exp_id

设置缺省值的命令

dmetrics metric_spec

dsort metric_spec

en_desc { on | off | =regexp }

仅为性能分析器设置缺省值的命令

tabs tab_spec

rtabs tab_spec

tlmode tl_mode

tldata tl_data

杂项命令

procstats

script file

version

quit

help

表达式语法

示例过滤器表达式

er_print 命令示例

6.  了解性能分析器及其数据

7.  了解带注释的源代码和反汇编数据

8.  操作实验

9.  内核分析

索引

er_print 命令示例

本节提供一些使用 er_print 命令的示例。

示例 5-8 显示函数中时间花费情况的摘要

er_print -functions test.1.er

示例 5-9 显示调用方-被调用方关系

er_print -callers-callees test.1.er

示例 5-10 显示热点源代码行

源代码行信息假设代码已使用 -g 进行编译和链接。将尾随下划线附加到 Fortran 函数和例程的函数名称。函数名称后的 1 用于区分 myfunction 的多个实例。

er_print -source  myfunction 1 test.1.er

示例 5-11 从用户函数堆栈过滤名为 myfunc 的函数:

er_print -filters 'FNAME("myfunc") SOME IN USTACK' -functions test.1.er

示例 5-12 生成类似于 gprof 的输出

以下示例从实验生成一个类似 gprof 的列表。输出是一个名为 er_print.out 的文件,该文件列出前 100 个函数,后跟调用方-被调用方数据(按每个函数的归属用户时间排序)。

er_print -outfile  er_print.out -metrics e.%user -sort e.user \
-limit 100 -func -callers-callees test.1.er

也可以将此示例简化为以下独立的命令。但是请记住,在大型实验或应用程序中对 er_print 的每次调用可能需要花费很长时间。

er_print -metrics  e.%user -limit 100  -functions test.1.er
er_print -metrics  e.%user -callers-callees test.1.er

示例 5-13 仅显示编译器注释

无需运行程序即可使用此命令。

er_src -myfile.o

示例 5-14 使用挂钟分析来列出函数和调用方-被调用方

er_print -metrics  ei.%wall -functions test.1.er
er_print -metrics aei.%wall  -callers-callees test.1.er

示例 5-15 运行包含 er_print 命令的脚本

er_print -script myscriptfile test.1.er

myscriptfile 脚本包含 er_print 命令。脚本文件内容的样例如下:

## myscriptfile

## Send script output to standard output
outfile -

## Display descriptive information about the experiments
header

## Write out the sample data for all experiments
overview

## Write out execution statistics, aggregated over 
## the current sample set for all experiments
statistics

## List functions
functions

## Display status and names of available load objects
object_list


## Write out annotated disassembly code for systime, 
## to file disasm.out
outfile disasm.out
disasm systime


## Write out annotated source code for synprog.c 
## to file source.out
outfile source.out
source synprog.c

## Terminate processing of the script
quit