Tracing (software)
Encyclopedia
In software engineering
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...

, tracing is a specialized use of logging to record information about a program's execution. This information is typically used by programmer
Programmer
A programmer, computer programmer or coder is someone who writes computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software. One who practices or professes a formal approach to...

s for debugging
Debugging
Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge...

 purposes, and additionally, depending on the type and detail of information contained in a trace log, by experienced system administrator
System administrator
A system administrator, IT systems administrator, systems administrator, or sysadmin is a person employed to maintain and operate a computer system and/or network...

s or technical support
Technical support
Technical support or tech support refers to a range of services by which enterprises provide assistance to users of technology products such as mobile phones, televisions, computers, software products or other electronic or mechanical goods...

 personnel and software monitoring tools to diagnose common problems with software. Tracing is a cross-cutting concern
Cross-cutting concern
In computer science, cross-cutting concerns are aspects of a program which affect other concerns.These concerns often cannot be cleanly decomposed from the rest of the system in both the design and implementation, and can result in either scattering , tangling , or both.For instance, if writing an...

.

There is not always a clear distinction between tracing and other forms of logging, except that the term tracing is almost never applied to logging that is a functional requirement of a program (therefore excluding logging of data from an external source, such as data acquisition
Data acquisition
Data acquisition is the process of sampling signals that measure real world physical conditions and converting the resulting samples into digital numeric values that can be manipulated by a computer. Data acquisition systems typically convert analog waveforms into digital values for processing...

 in a high-energy physics
Particle physics
Particle physics is a branch of physics that studies the existence and interactions of particles that are the constituents of what is usually referred to as matter or radiation. In current understanding, particles are excitations of quantum fields and interact following their dynamics...

 experiment, and write ahead logging
Write ahead logging
In computer science, write-ahead logging is a family of techniques for providing atomicity and durability in database systems....

). Logs that record program usage (such as a server log
Server log
A server log is a log file automatically created and maintained by a server of activity performed by it.A typical example is a web server log which maintains a history of page requests. The W3C maintains a standard format for web server log files, but other proprietary formats exist...

) or operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 events primarily of interest to a system administrator (see for example Event Viewer
Event Viewer
Event Viewer, a component of Microsoft's Windows NT line of operating systems, lets administrators and users view the event logs on a local or remote machine. In Windows Vista, Microsoft overhauled the event system.- Overview :...

) fall in a gray area with regards to terminology. This article deals with tracing that is primarily for debugging or diagnostic purposes.

Event logging versus tracing

Difficulties in making a clear distinction between event logging and software tracing arise from the fact that some of the same technologies are used for both, and further because many of the criteria that distinguish between the two are continuous rather than discrete. The following table lists some important, but by no means precise or universal, distinctions that are used by developers to select technologies for each purposes, and that guide the separate development of new technologies in each area:
Event logging Software tracing
Consumed primarily by system administrators Consumed primarily by developers
Logs "high level" information (e.g. failed installation of a program) Logs "low level" information (e.g. a thrown exception
Exception handling
Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....

)
Must not be too "noisy" (contain many duplicate events or information not helpful to its intended audience) Can be noisy
A standards-based
Standardization
Standardization is the process of developing and implementing technical standards.The goals of standardization can be to help with independence of single suppliers , compatibility, interoperability, safety, repeatability, or quality....

 output format is often desirable, sometimes even required
Few limitations on output format
Event log messages are often localized Localization is rarely a concern
Addition of new types of events, as well as new event messages, need not be agile Addition of new tracing messages must be agile

Event logging

Event logging provides system administrators with information useful for diagnostics and auditing. The different classes of events that will be logged, as well as what details will appear in the event messages, are often considered early in the development cycle. Many event logging technologies allow or even require each class of event to be assigned a unique "code", which is used by the event logging software or a separate viewer (e.g., Event Viewer) to format and output a human-readable message. This facilitates localization and allows system administrators to more easily obtain information on problems that occur.

Because event logging is used to log high-level information (often failure information), performance of the logging implementation is often less important.

A special concern, preventing duplicate events from being recorded "too often" is taken care of through event throttling.

Software tracing

Software tracing provides developers with information useful for debugging. This information is used both during the development cycle and after the software is released. Unlike event logging, software tracing usually does not have the concept of a "class" of event or an "event code". Other reasons that event logging solutions based on event codes are inappropriate for software tracing include:
  • Because software tracing is low-level, there are often many more types of messages that would need to be defined, many of which would only be used at one place in the code. The event code paradigm introduces significant development overhead for these "one-shot" messages.
  • The types of messages that are logged are often less stable through the development cycle than for event logging.
  • Because the tracing output is intended to be consumed by the developer, the messages don't need to be localized. Keeping tracing messages separate from other resources that need to be localized (such as event messages) is therefore important.
  • There are messages that should never be seen
    Assertion (computing)
    In computer programming, an assertion is a predicate placed in a program to indicate that the developer thinks that the predicate is always true at that place.For example, the following code contains two assertions:...

    .
  • Tracing messages should be kept in the code, because they can add to the readability of the code. This is not always possible or feasible with event logging solutions.


Another important consideration for software tracing is performance. Because software tracing is low-level, the possible volume of trace messages is much higher. To address performance concerns, it often must be possible for software tracing to be turned off, either at compile-time
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 or run-time.

Other special concerns:
  • In proprietary software
    Proprietary software
    Proprietary software is computer software licensed under exclusive legal right of the copyright holder. The licensee is given the right to use the software under certain conditions, while restricted from other uses, such as modification, further distribution, or reverse engineering.Complementary...

    , tracing data may include sensitive information about the product's source code
    Source code
    In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

    .
  • If tracing is enabled or disabled at run-time, many methods of tracing require a significant amount of additional data be included in the binary, which can indirectly hurt performance even when tracing is disabled.
  • If tracing is enabled or disabled at compile-time, getting trace data for a problem on a customer machine depends on the customer being willing and able to install a special, tracing-enabled version of your software and then duplicating the problem.
  • Many uses of tracing have very stringent robustness
    Robustness (computer science)
    In computer science, robustness is the ability of a computer system to cope with errors during execution or the ability of an algorithm to continue to operate despite abnormalities in input, calculations, etc. Formal techniques, such as fuzz testing, are essential to showing robustness since this...

     requirements. This is both in the robustness of the trace output but also in that the use-case being traced should not be disrupted.
  • In operating systems, tracing is sometimes useful in situations (such as boot
    Booting
    In computing, booting is a process that begins when a user turns on a computer system and prepares the computer to perform its normal operations. On modern computers, this typically involves loading and starting an operating system. The boot sequence is the initial set of operations that the...

    ) where some of the technologies used to provide event logging may not be available.

Technologies and techniques

Software tracing:
  • Tracing macros
  • Output to debugger (see for example http://msdn2.microsoft.com/en-us/library/aa363362.aspx)
  • Aspect-oriented programming
    Aspect-oriented programming
    In computing, aspect-oriented programming is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns...

     and related instrumentation
    Instrumentation (computer programming)
    In context of computer programming, instrumentation refers to an ability to monitor or measure the level of a product's performance, to diagnose errors and to write trace information. Programmers implement instrumentation in the form of code instructions that monitor specific components in a system...

     techniques
  • Windows software trace preprocessor
    Windows software trace preprocessor
    The Windows software trace preprocessor is a preprocessor that simplifies the use of WMI event tracing to implement efficient software tracing in drivers and applications that target Windows 2000 and later operating systems...

     (aka WPP)
  • Linux system level and user level tracing with Kernel Markers
    Kernel marker
    Kernel markers were a static kernel instrumentation support mechanism for Linux kernel source code, allowing special tools such as LTTng or SystemTap to trace information exposed by these probe points...

     and LTTng
    LTTng
    LTTng is a system software package for tracing the Linux kernel. LTTng consists of a kernel patch and a kernel module package. It is used together with*ltt-control, a toolchain to control tracing, and...

  • Linux application tracing with UST part of the same project as LTTng
    LTTng
    LTTng is a system software package for tracing the Linux kernel. LTTng consists of a kernel patch and a kernel module package. It is used together with*ltt-control, a toolchain to control tracing, and...

  • The Tracealyzer is a commercial tracing tool for embedded software, with an open recorder interface which can be adapted to most RTOS. Percepio AB provides a solution for FreeRTOS and a special version for RTXC Quadros
    RTXC Quadros
    RTXC Quadros is a real time operating system written mainly in the C programming language. It is mainly intended for use in embedded systems.The RTXC RTOS was originally developed by AT Barrett and Associates in the 1970s. It is currently maintained by Quadros Systems, Inc...

     is sold by Quadros Systems as RTXCview.


Event logging:
  • syslog
    Syslog
    Syslog is a standard for computer data logging. It allows separation of the software that generates messages from the system that stores them and the software that reports and analyzes them...

     (see article for specific implementations)
  • Event Logging APIs for Microsoft Windows
    Microsoft Windows
    Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

  • Windows Event Log (new for Windows Vista
    Windows Vista
    Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...

    )


Appropriate for both:
  • Apache logging
  • Event Tracing for Windows
  • Java logging APIs
  • Visual Basic logging (for Visual Basic .NET
    Visual Basic .NET
    Visual Basic .NET , is an object-oriented computer programming language that can be viewed as an evolution of the classic Visual Basic , which is implemented on the .NET Framework...

    )
  • Logcheck: a free and open-source utility to manage logs
  • X-Trace (research project)
  • Instruction set simulation
    Instruction Set Simulator
    An instruction set simulator is a simulation model, usually coded in a high-level programming language, which mimics the behavior of a mainframe or microprocessor by "reading" instructions and maintaining internal variables which represent the processor's registers.Instruction simulation is a...


External references

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK