.NET Customisation User Guide

.NET Customisation : How to Write a CAF Addin : Tracing and Optimisation
The PdmsTrace class gives access to all the facilities of the PDMS trace system and provides a means of outputting general trace messages and values during processing. PdmsTrace functions also enable querying and setting of PDMS trace flags; give access to the current state of the call stack; and allow starting and stopping of CPU time tracing.
The TraceEntry class provides the means to trace the entry and exit of functions as processing takes place. As the nesting of function calls gets deeper and deeper the function entry messages are indented further and further. Though this output can quickly get verbose it can frequently give evidence of problems in the code - for example functions being called too frequently … or not at all!
TraceEntry tr = TraceEntry.Enter("Start", (TraceNumber)101);
tr.Dispose(); // explicit call on exit
using (TraceEntry tr = TraceEntry.Enter("Start", (TraceNumber)101))
}    // implicit call to Dispose() on exit from the block
PdmsTrace.SetTraceFlag((TraceNumber)101, 1);
PdmsTrace.StartCPUTrace();
PdmsTrace.StopCPUTrace(true);

1974 to current year. AVEVA Solutions Limited and its subsidiaries. All rights reserved.
AVEVA Logo