PSL Profiler Tool
The PSL Profiler is a measurement component built into the PATROL Agent to measure how many resources each PSL script consumes. This allows the determination of which scripts have the largest usage cost and provides information as to where the cost is distributed within the PSL script.
The main PATROL Agent resource measured by the PSL Profiler is CPU time. This is broken into user time and system time, to indicate that the system calls may take some time in some of the PSL built-in functions. The PSL Profiler does not explicitly measure other cost measures such as the number of child processes, the amount of memory, PSL locks, global channels, and so on. However, some of this information can be gathered from the execution counts and the built-in function call counts. For example, child processes can be measured reasonably accurately as the number of calls to PSL system(), execute(), and popen() functions.
The PSL Profiler tool is used to collect profiling information from PSL processes. Primarily, the PSL Profiler records which PSL functions are called, how often each PSL function is called, and the time spent in each PSL function for each PSL process. All the profiling information that is collected for a PSL process is stored internally until the PSL process exits. When the PSL process does exit, the profiling information is written to the binary file specified by the PSL_PROF_LOG environment variable.
The PSL Profiler saves the profile data for PSL processes to the profile file as they terminate. Profiler output is saved in the file specified by the PSL_PROF_LOG environment variable. When the PATROL Agent is shut down in an orderly fashion, the Profiler saves the profile data for those PSL processes that have not been destroyed.
There are a number of interfaces to the PSL Profiler:
- PSL functions--The PSL Profiler can be dynamically enabled via PSL and reports can be printed in PSL.
- PSL Profiler Viewer (ppv) utility--This is an off-line reporting tool that analyzes a profiling data file that the PATROL Agent can generate during profiling.
- PSL Profiler API--The PSL Profiler API allows the PSL Profiler to be controlled (started, stopped, etc.) and queried at run-time.
- Supported Platforms
- Resource Requirements
- When to Use the PSL Profiler
- How to Install the PSL Profiler
- How to Start the PSL Profiler
- PSL Profiler PSL Functions
- About the PSL Profile Viewer (ppv) Tool
- About the PSL Profiler API
Where to go from here
Supported Platforms
Operating Systems
- UNIX
- Windows
PATROL Versions
PATROL 3.2 and later Agent
To Use the PSL Profiling Capability in PATROL v3.1
The list of PSL processes currently running in the Agent can be sampled and used to generate a rough picture of the cost of each PSL process. Use this tool as a sampling technique for PATROL v3.1 products in lieu of the PSL Profiler offered in v3.2.
Resource Requirements
PSL Profiler requires no additional resources beyond those specified for running the PATROL for Windows product.
When to Use the PSL Profiler
The primary purpose of the PATROL profiling tools in the KM development environment is to aid in the KM performance tuning task.
Use the PSL Profiler to
- tune the CPU usage of a PSL script
- find the highest consuming PSL script
- tune the number of external processes
The Profiler tools can also be used as a PATROL Agent configuration or deployment tool in production systems to determine which KMs and PSL scripts are taking too many resources.
Limitations of the PSL Profiler
The main limitation of the PSL Profiler is that it does not go very deep within each script to examine performance. For example, there is no line-by-line report showing which lines are executed most frequently. The analysis of built-in functions is useful but there is no similar analysis of PSL user-defined functions. The PSL Profiler can be dynamically enabled and disabled during Agent execution. Enabling the PSL Profiler will turn on the measurement for the specified PSL scripts. Disabling the Profiler will discard all measured data and return the Agent to the normal non-profiling state.
The impact of turning on the PSL Profiler is a marginal degradation of PSL execution performance. This results because each PSL timeslice must also be added to measurement counters. However, this is mainly a low in-memory cost. The largest costs are when the reports are generated. Reports are generated only when the data have been collected.
How to Install the PSL Profiler
This tool is part of the PATROL product. No further setup is required once PATROL has been installed.
About the PSL Profiler API
The PSL Profiler API allows the PSL Profiler to be controlled (started, stopped, etc.) and queried at run-time. Profiling is possible without needing the -profiling option and without stopping the Agent.
Profiling behavior is controlled by assigning a process the sum of one or more of the following options:
Value | Description |
---|---|
0 | disable profiling |
1 | enable process-level profiling |
2 | enable function-level profiling |
4 | cumulative |
8 | save at exit |
When first created, a process is assigned the current default Profiler options. The sum of the default Profiler options is 15 if the Agent is started with the -profiling option ( -p option for the PSL stand-alone) or 0 otherwise.
Where to go from here