D-trace: An Introduction
Offlate i am getting high on this very interesting tool I came across, lets say one of the most powerful and important advantages of the Solaris operating system. D-trace, as the name suggests is a tracing tool, more of a debugging kind. It opens your application in the Solaris/OpenSolaris kernel like a surgeon. It is able to trace you application while it is still in under execution. It does help us to understand the code better and so the platform on which it works. It also helps in fine tuning the applications for better efficiency and removing redundancies.
Dynamic Tracing (DTrace) is a debugging tool introduced in the SolarisTM 10 Operating System to help debug systemic problems that are difficult to diagnose using traditional debugging tools and mechanisms. This tool takes advantage of points of instrumentation in the Solaris OS to present information useful for debugging errors and investigating performance issues in applications running on the Solaris platform.
DTrace is designed to offer these features:
• No production risk. DTrace is considered the only debugging tool currently available that is safe to use on production systems. By design, DTrace does not allow constructs that can bring down the system through careless programming, such as loops and pointers. The absence of looping prevents users from leaving an unending loop that results in nightmarish system downtime. The absence of pointers prevents DTrace users from affecting memory allocated to kernel or application processes. Though it is possible to cause problems to production systems with DTrace, a user has to do so intentionally. Casual usage cannot interfere with production activities.
• No implications. The Solaris 10 OS includes nearly 40,000 probes that are points of instrumentation in the Solaris kernel. This instrumentation can be turned on and off at will, leaving no overhead when the tracing is turned off. This feature is very important as it helps you troubleshoot live production systems. You can use DTrace to query these probes and develop a picture of how an application is utilizing the kernel.
• Extensibility. You can combine queries to create custom probes. A framework is provided to trace user land functions. In addition, you can create custom probes in user applications to provide the ability to use DTrace to obtain information specific to the application during runtime within the semantics of the application.
While running through D-Trace, you would often come across the word probe. a probe is a specific point in the kernel's source code. When a program execution passes one of these points, the probe that enabled it is referred to as having fired. I will not mention how the dtrace works, as it is another subject of its own. I would surely mention some examples of dtrace which can be run in the following articles to come.