DTrace

DTrace (Dynamic Tracing ) is a system developed by Sun Microsystems system tool for kernel and application analysis in real time. Originally developed for Solaris, it is now ported to several Unix -like systems.

DTrace provides inspection capabilities in running processes, memory, processor time, file system and network resources.

Description

DTrace was developed to optimize applications and the operating system itself and fix error (" debugging" ).

Monitoring programs are written in the D programming language (not to be confused with the programming language " D"). D is a subset of C, which was ( built-ins ) extended for process monitoring with additional commands, variables, and built-in functions. D programs are similar in structure to the programming language awk. They consist of a list of test probes, each test probe may be connected to an action. Whenever the conditions of a probe are met, the associated action is executed. A typical test probe is, for example, opening a file, the start of a process or when a machine instruction is executed at a particular memory address.

Particular attention has been devoted to the safe use in a production environment. Therefore, no loops are allowed, for example, in the D programming language. Although DTrace changed the code to be executed ( in the kernel or in the application), it slows down even with thousands of test probes the system only slightly, if the test probes are run, and otherwise not. In addition, new probes can be added at runtime for applications.

Examples

DTrace scripts can be called directly from the command line. Their output is always on the standard output stream.

# New Process with arguments dtrace - n ' proc ::: exec -success {trace ( curpsinfo -> pr_psargs ); } ' # Files were opened by a process, dtrace - n ' syscall :: open *: entry { printf ("% s% s", execname, copyinstr ( arg0 ) ); } ' # Number of views of a program system procedure, dtrace - n ' syscall ::: entry { @ num [ execname ] = count (); } ' # Number of system procedure views of the system, dtrace - n ' syscall ::: entry { @ num [ probefunc ] = count (); } ' # Number of views system procedure of a process, dtrace - n ' syscall ::: entry { @ num [ pid, execname ] = count (); } ' # Required disk space of a process, dtrace - n ' io ::: start { printf ("% d% s% d", pid, execname, args -> b_bcount ); } ' # Number of pages that were paged through the process, dtrace - n ' vminfo ::: pgpgin {@ pg [ execname ] = sum ( arg0 ); } ' There is often the largest part of a DTrace script only from the formatted output of the results. Over 200 examples of open source DTrace scripts can be found in DTraceTookit together with documentation and demonstration.

Supported Platforms

DTrace was released in November 2003 and is since January 2005 part of Solaris. DTrace was the first core component of Solaris, which has been made ​​available for OpenSolaris under the Common Development and Distribution License.

DTrace has been ported to FreeBSD, NetBSD, and QNX.

Apple has integrated with Mac OS X 10.5 " Leopard" DTrace together with a graphical interface called Instruments and 40 monitoring probes scripts including tools for examining disk access ( iosnoop ) and process design ( exsecsnoop ) in the system. Unlike the other platforms has been ported to the DTrace, Mac OS X includes a flag ( P_LNOATTACH ), which can activate a program so that the respective process no longer debug software such as DTrace and gdb can be examined. In the original implementation on Mac OS X but this had an impact on independent test probes to monitor system information, because as long as a program ran, which had this flag set, the Systemprüfsonden were useless because they were no longer triggered. This problem was corrected a few months later with Mac OS X 10.5.3.

Currently a port for Linux is in the beta phase, which, however, only be disclosed with some features such as syscall, FBT, USDT, and a new Power Instruction, works. The implementation is provided as an optional kernel module, so that the source code of the kernel does not need to be changed. This is not only because of the portability needed, but also to avoid conflicts between the two licenses ( CDDL vs. GPL).

Authors and Awards

DTrace was developed by Bryan Cantrill, Mike Shapiro and Adam Leventhal. In 2005, the authors were honored due to the innovations of InfoWorld's Technology Review. Furthermore, DTrace was awarded the main prize of the Wall Street Journal's 2006 Innovation Awards competition.

248559
de