All Manuals > LispWorks® User Guide and Reference Manual > 12 The Profiler

12.7 Profiler tree file format

The profiler tree file is produced by calling save-current-profiler-tree, or by using the Save Profiler tree... item from the Profiler menu on the LispWorks IDE.

The file contains lines of text encoded UTF-8, to allow it to contain any symbol name.

The first line is handled specially: it must contain the string "LispWorks Profiler Tree" (without the quotes), which confirms that the file is a profiler tree file. In addition, the text following the first colon in the first line, with leading and trailing spaces removed, is the name of the tree.

The remaining lines in the file are the data lines, except those starting with a semicolon which are ignored.

Each data line is divided to 6 fields by a | character. The first 5 fields are integers and the last field is an arbitrary sequence of characters (any character except newline). There must be no spaces between the fields.

Each line specifies a node in the tree, in this format:

Depth|Count|Call-Count|Seen-Count|Top-Count|Name

Depth specifies the depth of the node, from which its location in the tree is deduced. The node with depth 0 is the root. For other nodes, the parent of the node is the previous node in the file which has depth smaller by 1. The children of the node, are all following nodes with depth larger by 1, until the next node with a depth less than or equal to Depth. In other words, each node is followed by its children in depth-first order.

Count is the number of times that the function associated with the node was seen on the call stack within the same branch of the tree, that is with the same chain of callers and on the same process.

Call-Count, Seen-Count, Top-Count and Name are the function-info of the function associated with the node. Hence they are not specific to the node itself and if the function occurs more than once in the tree (which is common), then copies of the function-info will be present in each occurrence.

The fields of the function-info are:

Call-Count
The number of times that the function was called, if this is recorded. Note that the count is not recorded by default in SMP LispWorks, so it is 0.
Seen-Count
The number of times that the function was seen in all the branches of the tree.
Top-Count
The number of times that the function was seen at the top of the stack, that is it was actually executing.
Name
The name of the function. Note that some nodes do not correspond to actual functions, in which case the name will be a string (including the double quotes).

12.7.1 Parsing the file

Because the function-info fields of each node are repeated for each occurrence of the same function, it is useful to record function-info keyed on the Name. This allows you to associate nodes that are in different branches of the tree but represent the same function.

The name can be read using the Common Lisp reader, provided the currently interned symbols are the same as the interned symbols when the file was produced. Otherwise you may get an error if the package of a symbol does not exist, or if it was external but it is not external when reading. In many cases, just using the name as a string is probably good enough.

12.7.2 Viewing the file as text

While it is not possible to see the tree in the file, you can perform simple "queries" just by viewing it in a text editor, for example checking if a function appears anywhere in the tree, finding how often it was visible or getting an idea which function(s) mostly call it.


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:20