Introduction to PHP and DTrace
DTrace is an always-available, low overhead, tracing frameworkavailable on a number of platforms including Solaris, Mac OS X,Oracle Linux and BSD. DTrace can trace operating system behaviorand user program execution. It can display argument values and beused to infer performance statistics. Probes are monitored by usercreated scripts written in the DTrace D scripting language. Thisallows efficient analysis of data points.
PHP probes that are not being actively monitored by a user's DTraceD script do not contain instrumented code so there is noperformance degradation during normal application execution.Probes that are being monitored incur an overhead low enough togenerally allow DTrace monitoring on live production systems.
PHP incorporates "User-level Statically Defined Tracing" (USDT)probes that are triggered at runtime. For example, when a D scriptis monitoring PHP's function-entry probe, then,every time a PHP script function is called, this probe is fired andthe associated D script action code is executed. This action codecould, for example, print probe arguments such as the source filelocation of the PHP function. Or the action could aggregate datasuch as the number of times each function is called.
Only the PHP USDT probes are described here. Refer to externalgeneral and operating system-specific DTrace literature to see howDTrace can be used to trace arbitrary functions, and how it can beused to trace operating system behavior. Note not all DTracefeatures are available in all DTrace implementations.
DTrace static probes are included in PHP 5.4. Prior to this theywere available via a » PECL extension, which is nowobsolete.
The static DTrace probes in PHP can alternatively be used with theSystemTap facility on some Linux distributions.
发表评论 取消回复