Macro Language Reference > Macros > Debug > tprof
  
tprof
Description
Allows you to see which tags take the most time during formatting and therefore optimize templates for maximum efficiency.
Syntax
tprof mode:n? tagname:s?
tprof
[no parameter]
Invoke the Format Profiling (Timing) dialog box.
mode
-1
Enable profiling (manual).
0
Disable profiling (manual).
1
Carry out automatic profiling of formatting during a tformat operation.
2
Carry out automatic profiling of formatting during a trf operation.
3
Carry out automatic profiling of formatting during a tprint operation.
10
Create report from collected data (manual).
11
Reset all collected data (manual).
To set up a manual profiling operation, macros and parameters should be entered consecutively to carry out the steps in the correct order:
1. Reset all profiling data with tprof 11
2. Enable profiling, either manually or automatically, eg. enable manual profiling with tprof -1
3. Format using trf or tformat or by typing text into PTC ALD WYSIWYG area.
4. Stop the profiling with tprof 0
5. Produce a report with tprof 10
6. Examine the log using the stream editor with ttagedit "tproflog"
Automatic profiling options greatly simplify the above procedure. During automatic profiling the starting, stopping and reporting is automatically carried out at appropriate times, leaving you to simply inspect the log (via ttagedit "tproflog" ) before the next occurence of the macro overwrites it. Remember to switch off profiling (via tprof 0) when you no longer need it as there is a small but significant overhead for it.
tagname
The name of the text tag to which to write the report log: the default value istproflog).
Additional Information
PTC ALD keeps two profiling statistics for each tag in your document:
The number of "ticks" spent formatting the tag.
The number of "ticks" spent formatting any descendant tags of the tag.
The period of a "tick" is important because the number of ticks for each tag will be displayed later in the profile log. The number of ticks in a second is given by getvar 01021 .
 
Due to the minimally intrusive method of profiling, the results in the log should be considered as an accurate estimate rather than exact. If APP formats a tag entirely between ticks then the tag has recorded a proportionate amount of time spent when compared to other tags. The important thing is that the tags that have taken most time will be at the top of the list.
When PTC ALD formats a document with profiling activated, it periodically updates the profiling information. During the update, formatting is temporarily suspended to examine the current formatting stack and add the number of elapsed ticks since the last update to each tag in the stack.
Related Links