第三十八章 使用^%SYS.MONLBL检查例程性能
例程^%SYS.MONLBL
为监视器工具提供用户界面。该实用程序提供了一种方法来诊断在例程中执行选定代码所花费的时间,从而帮助识别特别耗费资源的代码行。它是现有监视器实用程序的扩展,可通过^PerfMon
和%Monitor
系统程序包类访问。由于这些实用程序共享相同的内存分配,因此一次只能在IRIS
实例上运行其中一个实用程序。
调用逐行监视例程
如果在调用^%SYS.MONLBL
时监视器没有运行,则例程会显示一条警告消息,并提供启动监视器或检查内存要求的选项。例如:
%SYS>Do ^%SYS.MONLBL WARNING ! Starting the line-by-line monitor will enable the collection of statistics for *every* line of code executed by the selected routines and processes. This can have a significant impact on the performance of a system, and it is recommended that you do this on a 'test' system. The line-by-line monitor also allocates shared memory to track these statistics for each line of each routine selected. This is taken from the general shared memory already allocated and should be considered if you are using '*' wildcards and trying to analyze a large number of routines. If the monitor fails to start due to a problem with memory allocation, you may need to increase the Generic Memory Heap (gmheap) parameter in the system configuration. You may use the 'Memory Requirements' option to see how much memory a collection would need (without starting the collection). 1.) Start Monitor 2.) Memory Requirements Enter the number of your choice:
- 输入
1
开始对话框,以提供适当的信息以启动监视。 - 输入
2
以计算在实际启动监视器之前集合需要多少内存的估计值。
按 Enter
键退出程序。
估计内存需求
在开始监视过程之前,可以使用此实用程序来估计集合需要多少内存。通常,有足够的共享内存可用于监视一些例程。但是,如果想监控数百个或更多例程,请使用此选项来帮助确定内存需求。
例程和指标提示与 Start Monitor
选择的提示相同。选择要监控的例程和要收集的指标后,该实用程序会显示监控此集合所需的内存页数和可用页数。它还告诉在必要时增加通用内存堆参数的大小。
可以从管理门户的高级内存设置页面(系统管理 > 配置 > 其他设置 > 高级内存)维护 gmheap
(通用内存堆)设置。
以下是一个示例,它估算了监视以 JRN
开头的所有例程的八个选定指标的内存需求:
Enter the number of your choice: 2 Enter routine names to be monitored on a line by line basis. Patterns using '*' are allowed. Enter '?L' to see a list of routines already selected. Press 'Enter' to terminate input. Routine Name: JRN* (22 routines added to selection.) Routine Name: Select Metrics to monitor 1) Monitor Minimal Metrics 2) Monitor Lines (Coverage) 3) Monitor Global Metrics 4) Monitor All Metrics 5) Customize Monitor Metrics Enter the number of your choice: <1> 5 Enter metrics item number (press 'Enter' to terminate, ? for list) Metric#: 1 - GloRef Metric#: 2 - GloSet Metric#: 3 - GloKill Metric#: 25 - JrnEntry Metric#: 34 - RtnLine Metric#: 35 - RtnLoad Metric#: 51 - Time Metric#: 52 - TotalTime Metric#: 9 page(s) of memory required. 82 page(s) of memory available. The GenericHeapSize parameter can be increased if more memory is needed. Pages are each 64kb of memory. Press RETURN to continue ...
如果选择的集合需要,可以调整您的内存,然后从原始菜单中选择开始监控。