Previous Table of Contents Next


7.5 SOFTWARE VERSUS HARDWARE MONITORS

Given a monitoring problem, should a hardware monitor or a software monitor be used? The choice is not as difficult as it may appear. For most applications, only one of the two types of monitors will be satisfactory.

The first step in selecting the monitor is to consider what needs to be measured. Hardware monitors can sense electrical signals on the busses and can accurately record them even at high speed. However, it is difficult for them to determine higher level information, such as queue lengths or current user, unless the information is easily available in a hardware register. Software monitors, conversely, can easily determine the higher level information but cannot easily observe low-level events, such as time to fetch an operation code for an instruction. Examples of variables that can be observed by both types of monitors are device utilizations and CPU-I/O overlap.

The second consideration is the input rate, the rate at which events have to be observed. Hardware monitors can record events very quickly. A software monitor, on the other hand, may require a few hundred instructions per observation and so cannot be used if the interevent time is small.

The time resolution required is the next consideration. A hardware monitor has a separate hardware clock and can provide time resolution in a few nanoseconds. The software monitors use the system clock, which typically has a resolution of a few milliseconds.

The expertise of the performance analyst also should be taken into consideration in selecting the monitor. Only an analyst with a good knowledge of the system hardware can correctly use a hardware monitor. A software monitor, on the other hand, requires an intimate knowledge of the system software to be instrumented.

The amount of data recorded directly affects the overhead of a software monitor. If the amount is expected to be huge, a hardware monitor with builtin secondary storage may be used.

A software monitor, by its nature, is sequential in that it cannot record several simultaneous events (unless the software is distributed). For example, if several devices request service from the processor and post an interrupt, the interrupts will be serviced sequentially and will be observed by the software monitor sequentially. Hardware monitors have several probes that can record simultaneous events.

Software monitors consume system resources that would otherwise be available to the users. A hardware monitor, on the other hand, consumes little, if any, of the system resources. Its presence may or may not be visible to the system.

Most hardware monitors are designed to be attached to a variety of systems. Thus, the same monitor can be used to monitor systems from different vendors or systems using different operating systems. Software monitors are developed specifically for a particular hardware and software base and cannot be easily parted across vendors.

A hardware monitor keeps observing the system even when it is malfunctioning, and thus, it can be used to debug the system. A software monitor may not be able to observe correctly during malfunctions, and it may not run at all when the system is down.

TABLE 7.1 Comparison of Hardware and Software Monitors

Criterion Hardware Monitor Software Monitor

Domain Difficult to monitor operating system events. Difficult to monitor hardware events unless recognizable by an instruction.
Input rate Sampling rates of 105 per second possible. Sampling rate limited by the processor MIPS and overhead required.
Time resolution 10 nanoseconds is possible. Generally 10 to 16 milliseconds.
Expertise Requires intimate knowledge of hardware. Requires intimate knowledge of software.
Recording capacity Limited by memory and secondary storage. Not a problem currently. Limited by overhead desired.
Input width Can record several simultaneous events. Cannot record several simultaneous events unless there are multiple processors.
Monitor overhead None Overhead depends upon the input rate and input width. Less than 5% adequate and more than 100% possible.
Portability Generally portable. Specific to an operating system.
Availability Monitoring continues even during system malfunction or failure. Cannot monitor during system crash.
Errors Possible to connect the probes to wrong points. Once debugged, errors are rare.
Cost High Medium

Both hardware and software monitors can have bugs that can introduce errors into the measured data. However, with software monitors, once the software has been thoroughly debugged, errors are rare. With a fully debugged hardware monitor, it is possible to misplace probes.

Finally, and most importantly, hardware monitors are more expensive than software monitors. This fact alone may be sufficient to bias the choice in many cases.

The issues of hardware versus software monitors are summarized in Table 7.1.

7.6 FIRMWARE AND HYBRID MONITORS

Firmware monitors are implemented by modifying the processor microcode. These are useful for applications that fall between the software and hardware monitoring boundaries. In most respects, firmware monitors are similar to software monitors. However, since the microcode space is limited and there are tighter timing limitations, firmware monitors generally do very limited data reduction, if any. They are useful in applications where the timing considerations preclude the use of software monitors and inaccessability of probe points preclude the use of hardware monitors.

Firmware monitors have been used for network monitoring where existing network interfaces can be easily microprogrammed to monitor all traffic on the network. Another application suitable for firmware monitors is generating address profiles of microcode (micro-PC histograms). These profiles are used for optimizing the code.

A monitor using a combination of software, hardware, or firmware is a hybrid monitor. Software monitors have good data reduction capabilities, while hardware monitors have high resolution. Thus, a hybrid monitor, consisting of a hardware data-gathering component together with a software data reduction component, provides the best of both worlds.

An example of a hybrid monitor is the Diamond monitor described by Hughes (1980). The hardware part of the monitor consists of a board placed in the system cabinet. It can observe all traffic on the system bus. The software part can read instruction addresses, processor modes, and system and user identifications. The two parts can communicate through device status and control registers. The monitor has been used to generate address histograms, address traces, instruction traces, and others.


Previous Table of Contents Next

Copyright © John Wiley & Sons, Inc.