Touring AreasTour Areas: [1] Minimal Source Code Instrumentation

[5. Running the Logging Server ]
[6. View Data, Live and Recorded]
[7. The Data ]
[8. Reviewing Data ]
[9. The Documentation]

[1] Minimal Source Code Instrumentation

Fundamentally, DTraq is a data logging tool. Simply instrument the code with the "taps" needed to extract and log the data items you need to see. Taps can be removed for product release, although one ought to seriously consider leaving them in the delivered product as an on-site debugging and verification aid should problems arise; or especially if the application is required to log its activities during normal operation. (DTraq doesn't just help you find bugs, it will help you verify that your code is clean.

Instrumenting the application is done with the aid of a generic "Tap" procedure and a communications package:

  • generic procedure DTraq.Tap is the actual logging procedure that is instantiated for each type of data item that is to be tapped.
  • package DTraq.Client_Transport manages communications with the logging server.

An instantiation of DTraq.Tap is done for each type of data items whose values are to be logged and monitored. DTraq currently supports DTraq.Tap instantiations with scalar types (integer, modular, floating, character, and enumeration), constrained arrays (including subtypes or derived types of unconstrained arrays), and basic records (i.e., variant records aren't supported yet, but support for them is underway).

The arguments for a DTraq.Tap instantiation are the name of the type, a unique numeric identifier to associate with that type, and an optional string this is displayed in the list of tapped items.

So given some type declarations that look like this:

type Color_Type is (Red, Orange, Yellow, Green, Blue, Violet);

subtype Cs_Indexes is Positive range 1 .. 10;

subtype Capped_String_Type is String(Cs_Indexes);


type Flight_Modes is (Off, Parked, Taxi_In, Taxi_Out, Loading, Departure, Cruise, Approach, Landed);

type Latitudes is digits 6 range -90.0 .. 90.0;

type Longitudes is digits 6 range -180.0 .. 180.0;

type Altitudes is digits 6 range -100.0 .. 50_000.0;

subtype Home_Base_Name is String(1..3);

type Position is record

Latitude : Latitudes := 45.0;

Longitude : Longitudes := -93.0;

Altitude : Altitudes := 47.0;

end record;

type Position_History is array (1 .. 5) of Position;

type Flight_Status is record

Destination : String(1 .. 3) := "HSV";

Curr_Pos : Position;

Mode : Flight_Modes := Off;

History : Position_History;

Home_Base : Home_Base_Name := "MSP";

end record;

DTraq.Tap would be "withed" into the package or procedure, and these DTraq.Tap instanatiations would be inserted:

procedure Tap is

new Dtraq.Tap(Color_Type, 6, "Rainbows");

procedure Tap is

new Dtraq.Tap(Capped_String_Type, 10, "Capped_String_Type");

procedure Tap is

new Dtraq.Tap(Flight_Status, 1979, "Flight Status");


Now that instantiations of the Tap procedures exist, they can be invoked by the application at any point where the current values of the associated data items need to be logged.

Given the appropriate variable declarations, this is as simple as:




The next step the is to add the few lines of code necessary to establish the communication link to the logging server so that the tapped data that is transmitted to it can be logged, monitored, and subsequently played back.

Next: Establishing communications with the Logging Server

©2006 McKae Technologies