Number: 764

Date: 18-Apr-84 17':17':19

Submitter: Sannella.PA

Source: Masinter.pa

Subject: New graphic-display sampling statistics package -- SPY.DCOM

Lisp Version: 

Description: '
Date': 17 Apr 84 08':01 PST'
From': Masinter.pa'
Format': TEdit'
Subject': "Spy" tool for Interlisp-D': SampleStats'
To': LispFriends↑'
'
I''ve done a first version of a new tool for gathering performance statistics on programs using periodic sampling rather than the call+return log used by the ''Stats'' package.'
'
Its called SAMPLESTATS, and is on [phylum]<LispUsers>. Until a new release of Interlisp-D, you will need to load [phylum]<LispUsers>INTPATCH.DCOM.'
'
'
Here''s the documentation':'
'
Spy'
Larry Masinter'
17 April 84'
'
SPY is a tool that helps you find out where your program is spending its time. SPY gathers statistics by periodically interrupting the running program, and looking back on the stack. SPY then will display the timing information graphically, using the GRAPHER package.'
'
(SPY.START)						[function]'
Reinitializes the internal SPY data structures, and turns on sampling.'
'
(SPY.END)							[function]'
Turns off sampling'
'
(WITH-SPY form) 					[macro]'
Calls (SPY.START), evaluates form, calls (SPY.END), and then returns the value of form.'
'
(SPY.TREE)'
Displays the results of the last ''spy'' in a grapher window.'
'
SPY differs from the "Stats" facility in Interlisp-D in that it does not log EVERY call and return; it relies on statistical frequency instead. This means you can sample much larger calculations without worry of filling up your disk. Also, SPY doesn''t slow down the calculation nearly as much. However, SPY keeps its data structures in virtual memory, and may interfere some with working set.'
'
Internal controls':'
'
SPY.FREQUENCY					[variable]'
How many times per second to sample? Initially set to 10.'
(Maximum 60).'
'
Graphics controls (these may be reset before each call to SPY.TREE)':'
'
SPY.MAXLINES					[variable]'
The call display uses vertical bars to show the ratio of calls. SPY.MAXLINES is the height of the maximum bar, expressed in multiples of the font height. (initially 10 lines.)'
'
SPY.SHOW.THRESHOLD				[variable]'
Functions whose ''bar'' would be less than SPY.SHOW.THRESHOLD scanlines are not shown.'
'
'
SPY.SHOWCOUNTS					[variable]'
if NIL, the frequency bars are not shown. Initially T.'
'
Eventually, I would like to make the display more "interactive", e.g., allow you to point at nodes and get the subtree from that position, or merge nodes, etc. The information is still not as concise enough; comments, suggestions, ideas for improvement appreciated.'
'
Larry'
'
-----'
'
Date': 18 Apr 84 14':54 PST'
From': Masinter.pa'
Subject': Re': SAMPLESTATS = SPY'
In-reply-to': Sheil.pa''s message of 18 Apr 84 11':34 PST'
To': Sheil.pa'
cc': LispFriends↑'
'
I changed the name of the package in the middle of developing it; I think I edited every part of the message except the name of the FILE!'
'
Please load SPY.DCOM, not SAMPLESTATS.DCOM.'
'
Under rapid development...'
'
Larry'
'
-----'
'
Date': 22 Apr 84 23':10 PST'
From': vanMelle.pa'
Subject': Re': chat very slow in recent loadup -- suspect caretology'
In-reply-to': Masinter.pa''s message of 20 Apr 84 15':32 PST'
To': Masinter.pa'
cc': burton.pa, vanMelle.pa, LispSupport.pa'
'
. . . '
'
SPY, by the way, gave completely different information': it showed me spending about 3 times longer under CHAT.HANDLECHARACTER than under TAKEDOWNCARET.  So I''m not sure how much I trust it.'
'
-----'
'
Date':  1 May 84 17':57 PDT'
From': masinter.pa'
Subject': new version of SPY'
To': LispFriends↑'
cc': masinter.pa'
'
There is a new version of SPY on <LispUsers>. This version features':'
'
	* revised format for showing the nodes (boxes around nodes have height proportional to time)'
	* automatic ''merging'' of recursive descents and duplicate subtrees'
	* auto threshold -- won''t show up nodes with time less than given percentage'
	* ability to show both ''individual'' times (time spent in THAT function) and cumulative times (the default)'
'
It is still a little rough, but I think it is useful in its current form and I wanted to get it out for comments. Please note '
a) if you are not running in <LispCore>Next>, load <LISPUSERS>INTPATCH.DCOM before you try this.'
b) the Dolphin and Dorado have a bug which will cause incorrectly large amounts of time to be accumulated to \3MBGETPACKET (or whatever.)'
'
'
SPY is a tool that helps you find out where your program is spending its time. SPY gathers statistics by periodically interrupting the running program, and looking back on the stack. SPY then will display the timing information graphically, using the GRAPHER package.'
'
(SPY.START)						[function]'
Reinitializes the internal SPY data structures, and turns on sampling.'
'
(SPY.END)							[function]'
Turns off sampling'
'
(WITH-SPY form) 					[macro] Calls'
(SPY.START), evaluates form, calls (SPY.END), and then returns the'
value of form.'
'
(SPY.TREE threshold nomerge) Displays the results of the last ''spy'' in a grapher window. If ''NOMERGE'' is T, duplicate subtrees and recursions will NOT be merged.'
'
Once you have the tree, you can change the threshold and switch between individual and cumulative times by buttoning with the left button anywhere NOT on a node (it will give you a menu with two items when you let up).'
'
If you button on a node, first, the title of the window will change to show you to individual and cumulative percentage of time in the given node. You will get a menu which includes items':'
'
SubTree		Create another spy window which includes data only from this node and its descendents.'
'
(and some other options which are not yet implemented).'
'
'
SPY differs from the "Stats" facility in Interlisp-D in that it does not log EVERY call and return; it relies on statistical frequency instead. This means you can sample much larger calculations without worry of filling up your disk. Also, SPY doesn''t slow down the calculation nearly as much. However, SPY keeps its data structures in virtual memory, and may interfere some with working set.'
'
Internal controls':'
'
SPY.FREQUENCY					[variable] '
How many times per second to sample? Initially set to 10.  (Maximum 60).'
'
SPY.NOMERGEFNS		[variable]'
Functions on this list won''t get merged. Includes (ERRORSET \EVAL EVALFORM APPLY EVAL). You may need to add more.'
'
'


Workaround: 

Test Case: 

Edit-By: Sannella.PA

Edit-Date:  2-May-84 11':02':45

Attn: Release

Assigned To: Masinter.pa

In/By: 

Disposition: 

System: Programming Environment

Subsystem: Performance Tools

Machine: 

Disk: 

Microcode Version: 

Memory Size: 

File Server: 

Server Software Version: 

Difficulty: Moderate

Frequency: Everytime

Impact: Annoying

Priority: Perhaps

Status: Fixed

Problem Type: Bug

Source Files: