The XML resolution
XML easily solved these problems, and provided a reasonable structure for Coverage stack results. Using Internet Explorer as a default display device – easy to override – provided a simple presentation, and allows the user to collapse and expand the various “limbs” of the stack tree, just as a tree view would, but at far less cost. The XML log also is also economical in its use of disk space. The XML stacklevel document representing a typical TASTRADE.APP run, derived from a Coverage text log of 6 MB, requires about 800k of space.
Our first step, then would be to design an XML document that fit the data properly.
Figure 6, below, shows one of two separate StackXML documents generated by the VFP 7 Coverage engine; the two documents analyze the log slightly differently, but as you can see they are fairly straightforward.
The document level tag shown in the figure is a default version of the tag name. Refer to Appendix B “a sneak preview of new Coverage engine PEMs in VFP7” for list of new properties and methods added to the coverage engine class in VFP7 to support StackXML. This tag name is one of the “tuneable” options available from COV_TUNE.H, as you’ll see in the appendix.
In the “standard” document, shown in figure 6, all calls from one program component on one level will be included from one “root”. For example, if main.prg appears as a stacklevel 1 program, then you will only see one element under the XML document-level element for any successive level 1 main.prg lines in the log. (By “successive” I mean lines in the logs that may be separated by other programs at higher stacklevels, but none at the current stacklevel, 1 in this case.) A stacklevel 1 program with a different name, of course, would have its own tree. This can happen in a log, even at level 1, if you execute various applications from the command window while maintaining a single Coverage log.
If you choose “extended” StackXML, the engine generates a new parent tag whenever the Coverage text log has gone down into the stack, back up to a particular stack level, and then proceeds down again. In this format, main.prg could proceed to several level-2 calls, each of which would have its own tree. When the log next shows a program component at stack level 1, this XML format closes the first stack level 1 tag and opens a new one, whether or not the successive lines at this level were from the same program component.
The “standard” document is more compact and more intuitive if you are looking for an overview of “what calls what”. The “extended” document structure is more accurate, especially if you are doing performance analysis of the separate trees, because it takes into account the fact that the parent program may have been re-invoked, possibly with different parameters, rather than continuing procedurally after the called program returns.
Looking carefully at this resolution
It would have been possible to offer only one base document (the extended one) and then use XSLT transformation to provide the other document on demand. However, providing two base document structures gives each both equal weight as valid base representations.
Figure 6, a sample of Coverage 7 StackXML output.