SpyToolDoc.tioga
Michael Plass, October 9, 1991 2:49 pm PDT
SpyTool
CEDAR 10.0
SpyTool
An interactive data-analysis tool for Spy data
Michael Plass
© Copyright 1990, 1991 Xerox Corporation. All rights reserved.
Abstract: This is the data-analysis part of the PCedar Spy. See Spy for the data collection.
Created by: Michael Plass
Maintained by: Michael Plass:PARC:Xerox
Keywords: performance measurement, tuning, memory allocations, timing, CPU usage, Spy, Viewer
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

Introduction
The Spy is designed to be the main tool for analyzing the performance of programs in PCedar. With the Spy, the programmer can see which procedures are consuming CPU cycles, which are using the allocator, or which are calling a particular procedure.
The main paradigm of the Spy is to record the call stack of an interesting process. The definition of "interesting" varies according to what the Spy is measuring. If the Spy is measuring CPU usage, it records the stack of the top-most active process at regular intervals. The only things recorded are the procedures in the call stack; parameters and local variables are not recorded.
The PCedar spy is a new implementation, based on the concepts to both the Interlisp Spy by Larry Masinter and the DCedar Spy by John Maxwell.
Commands
These commands may be used to start and stop the Spy from a Commander.
SpyStart Start the spy. Arguments:
-a  => watch allocations
-w => watch words allocated
-t  => watch thread switches (default)
-~t => do not watch thread switches
-n <n> => preallocate n spy tree nodes (default 10000)
SpyStop Stop the spy, write results to specified file (or to standard out, if no argument is provided).
SpyClearBreaks Clear all spy breaks
SpySetTraceBreak <cprocname> - set a spy trace break
To create a SpyTool to analyze the data:
SpyTool <filename> - create a tool to anaylze data created with SpyStart/SpyStop commands
Driving the spy tree analysis tool
Use the vertical and horizontal scroll bars for moving around.
Color code:
  The unshaded area at the top is just the additional space needed to display the text contents.
  The pale cyan shading shows the proportion of samples that were collected in callees of that procedure.
  Gray indicates samples that were below the display cutoff.
  The pinkish-brown shading at the bottom shows the proportion of samples that were collected in that procedure.
  The violet in the root node indicates the merged subtrees, when merging is enabled.
Data reduction that has been applied:
Direct recursive calls are collapsed down (as if the recursion had been removed by hand). Calls on XR𡤎nable and their direct callees are collapsed into the caller, on the presumption that this happened because of ENABLE or [! ... ] in the Cedar source. The mimosa-generated "←P4200" suffixes are stripped, as are the leading underscores.
The menu items:
C0 C1 C3 C5 C10
Set the cutoff to the corresponding percentage (of the root).
Junk
Left-click to see the all thread switches, including those that were not caused by preemption (Yield, Wait, etc.) Right-click to hide them again.
Enables
Left-click to see the extra layers of procedure call used to implement Mesa's catch phrases. Right-click to hide them again.
SelfCalls
Left-click to see self-recursive calls displayed in full; Right-click to collapse them again.
Threads
Left-click to partition the data by thread ID. Right-click to merge them again.
Merge
Left-click to merge similar subtrees together. Right-click to turn off merging.
Chains
Left-click to turn off the "stacking" of the call chains in the display; this stacking is done by default to conserve horizontal space. Right-click to (you guessed it) turn on the stacked display.
PrevRoot
Pop the stack of root nodes (see cntl-shift-click, below).
UnDelete
Undo the effects of all deletes (see cntl-left-click, below).
Clicking at the nodes in the tree will do the following:
cntl-shift-click - MOVE the node to the root of the displayed tree
cntl-left-click - DELETE the node from the display (pretend the samples never happened)
cntl-right-click - UNDELETE all decendants of the node (including Junk)
shift-click - COPY the text contents of the node to the current input focus
See Also
SpyDoc.tioga tells you how to collect the data using a Commander-based interface.