Tracing and Optimization
- Last UpdatedNov 10, 2025
- 3 minute read
Suggestions to minimize the speed of start-up of addins have been made above. There are two built-in ways to monitor this and investigate the reasons if poor performance is suspected.
Reviewing Addin Start-up Time
Target start-up time for an Addin should be no more than 1 second, if possible. To find out how long your Addin takes to start-up set the following environment variable:
set AVEVA_CAF_TRACING=PERFORMANCE
Output similar to the following will then be displayed in the Console Window:
AVEVA PDMS Design Mk12.1.SP1.0[3430] (WINDOWS-NT 5.1) (5 Nov 2010 : 18:49)
(c) Copyright 1974 to 2010 AVEVA Solutions Limited
Issued to APDian.steele-ukcamsplsNO-TE-St
Loading addins took 0.793 seconds
Starting addin Explorer took 1.108 seconds
Starting addin DrawList took 0.135 seconds
Starting addin MyData took 0.810 seconds
Starting addin History took 0.110 seconds
Starting addin ReferenceList took 0.060 seconds
Starting addin PipeCheck took 0.683 seconds
Starting addin Output took 1.580 seconds
Starting addin Find took 0.343 seconds
Starting addin Links Addin took 0.126 seconds
Starting addin Attributes took 1.015 seconds
Starting addin Status Controller took 0.128 seconds
Total time starting addins 6.098 seconds
Cleared existing tools in 0.009 seconds.
Loading UIC file C:\AVEVA\PDMSEXE\design.uic
Defined new tools in 0.039 seconds.
Loading UIC file C:\AVEVA\PDMSEXE\StatusController.uic
Defined new tools in 0.009 seconds.
Loading UIC file C:\AVEVA\PDMSEXE\CoreSchematicMenu.uic
Defined new tools in 0.008 seconds.
Loading UIC file C:\AVEVA\PDMSEXE\BAS.uic
Defined new tools in 0.000 seconds.
Loading UIC file C:\AVEVA\PDMSEXE\UserDesign.uic
Defined new tools in 0.000 seconds.
Loading XML GUI took 0.068 seconds
Processing UILoaded event tool 0.057 seconds
Loading CommandBar layout took 0.801 seconds
DockManager.LoadFromXML in 1.118 seconds.
Loading Window Layout took 1.119 seconds
Standard PDMS Tracing
The standard facilities found in the classes of the Aveva.Pdms.Utilities.Tracing namespace can be used for tracing performance problems as well as for other general coding investigations.
-
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!
To work correctly in C#, TraceEntry needs to know about entry and exit from functions in correct chronological order. There is a difficulty with this in C# because of the way that "garbage collection" works in that language. This means, in particular, it is necessary to ensure that the function exit event occurs at the right moment. This can be achieved by using the Dispose method explicitly:
TraceEntry tr = TraceEntry.Enter("Start", (TraceNumber)101);
// ...
// code being traced ...
// ...
tr.Dispose(); // explicit call on exit
There are still problems with this however as you will need to catch every "return" statement individually. Also the Dispose() method will never be called if an exception occurs. A simpler and more robust way is to do this job using the C# "using" command as follows:
using (TraceEntry tr = TraceEntry.Enter("Start", (TraceNumber)101))
{
// ...
// code being traced ...
// ...
} // implicit call to Dispose() on exit from the block
// even if there are exceptions or multiple return statements
If you are using these facilities to investigate the start-up of an addin, you will need to set the chosen trace flag from your code:
PdmsTrace.SetTraceFlag((TraceNumber)101, 1);
And, finally, you can use the PDMS CPU time profiling options in conjunction with TraceEntry by using:
PdmsTrace.StartCPUTrace();
// ...
// code being timed ...
// ...
PdmsTrace.StopCPUTrace(true);