1
0
mirror of synced 2026-01-13 15:37:38 +00:00
2020-12-13 17:04:48 -07:00

49 lines
17 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1
Medley for the Novice, Release 2.0
1
Medley for the Novice, Release 2.0
19. WHERE DOES ALL THE TIME GO? SPY
1
19. WHERE DOES ALL THE TIME GO? SPY
1
"19"19. WHERE DOES ALL THE TIME GO? SPY
6
SPY(SPY NIL NIL NIL NIL 1) is an Lisp library package that shows you where you spend your time when you run your system. It is easy to learn, and very useful when trying to make programs run faster.
How to Use Spy with the SPY Window
1
The function SPY.BUTTON(SPY.BUTTON (Function) NIL NIL NIL 1) brings up a small window which you will be prompted to position. Using the mouse buttons in this window controls the action of the SPY program. When you are not using SPY, the window appears as in Figure 19.1.
CFÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿ€```cçæÇ!€f66 f630 g†30çß €cæ1à3 `÷àÀ3 f6À3 f6À3 Q€f6À3 Àã `!€```J¿ýQ€dPô@`_ÿ·T!€dA?ßz<C39F>`*~éKõ@I€`AVªÚ„ €bŸöÑÿ‘©€`_ýT(ÿÂQ€eÿRô©€cþÔcy úé€cú$
ö¹€ i€cèAµ¹€eROi€g "/¹€`]~٪ـeR—d<E28094>/¹€b_}ÿB “I€a·ÿ «i€d¬‰+òQ€b¶b;¹²‘€eü
©€b¨Šˆ4©Q€d&ލ!€<66>t%B Q€a I°P €dZ$<24>d<EFBFBD>)€bJ€TZPI€` ""‚•©!€a
z a@ˆˆ<CB86>¿@!€dú€‰€aX""#ýP €a£!€b¨AH¯Xad"!€eºET½Aay›þ!€`ŽæÛü‰€`;ÿwð@`MÝßåQ€`#}ÿ‚`
¾ê!€dAV``ÿÿÿÿÿÿÿ€ÿÿÿÿÿÿÿ€
Figure 19.1. SPY Window(SPY% WINDOW NIL SPY% Window NIL NIL 1) When SPY is Not Being Used
To use SPY, click either the left or middle mouse button with the mouse cursor in the SPY window. The window will appear as in Figure 19.2, and means that SPY is accumulating data about your program.
BFÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÀÀÀÇÏÌ0Ìll0Ìlf`Ï f`ÏÀÇÌcÀ l`ÁïÁ€ l`Ìl l`Ìl l`Ìl l`ÇÌÌ`ÀÀÀÀ•ú£È ÿè€À¿ÿn¨CÈ‚¾õ #ÀTýҗꀓÀþ­Å?í¢ ÿ£SÀ¿ú¨Qþ„£Ëþ¤éSÇý¨ߥ#Æò@ õÓÇôHísËÈ@þÓÇЂ%ksʤ(žÓÏAD_sÀºý²Ê¥.É _sľûþ„A&“Â+oý@ÉY
£Ål«·Re#Ê/øè@SÅUOëZÈ ÿÿùRCÍDÿÿÔ‰R£Â¿ÿî È+ÿÿ«SÄŒ½}þ “À]/úÿûC´þ #¹/ø_ÿ€CÈäê/¤AÂðMtWõ Á& ,CÀP“Ñ_¤€Â@<14>CÈA
BVˆÀ€”” CÁ À@
À@£À@ÀCÈ€ #ÀÀÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
Figure 19.2. SPY Window When SPY is Being Used
To turn off SPY after the program has run, again click a mouse button in the SPY window. The eye closes, and you are asked to position another window. This window contains SPY's results. An example of the resulting window is shown in Figure 19.3.
hœÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ~ûà?ãÇÿÿÿÿ÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ}ö÷wýÿÝ»ÿÿÿÿ÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ}þ÷wýÿÝ»ñã¦tw?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ~÷¯ýÿÝ»îÝ™³¶íßÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþßýÿá»ññ»·¶?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþöÿßýÿý»þÍ»·¶ÿßÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ}öÿßýÿÝ»îÝ»³¶íßÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ~ÿßýçãÇñâ»´w?ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿ÷ÿÿÿÿÿ÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿïÿÿÿÿÿ÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ```ÿÿÿÿÿÿÿÿÿÿøDDDDD`ÿÿÿÿÿÿÿÿÿÿøfîîîì eÝÝÝÜ AŒ”c3330 Œ>èû€çÏ1˜ BR¤c3330
MÂ@”¥(JX BPÀf€, OÂ@”¥BBPÀe€Jó€ç%1Ÿÿÿÿá BP¤c0,ˆJ€…%X BR”c0,<2C>HÂH„¥(JXœˆf€,ˆèúH„˜Ï1˜e€Lc0Œc0 f€,ÿÿÿÿÿÿÿÿÿÿøe€ÿÿÿÿÿÿÿÿÿÿøc0ÿÿÿÿÿÿÿÿÿÿÿÿÿüc0ÿÿÿÿÿÿÿÿÿÿÿÿÿüf€, e€ c0 c0 f€, e€@ c0@ c0
Œ8FIœd¥ÀsŒg˜Ìf€,R$©RR”µ JR”%,e€ B$¨b”½ JR„! c0 8¨bÜ”½ sÌc0%øRT”­ B,f€,.%JR”­$BR”%,e€¹EÒc%ÄBLg˜Ìc0Œ c0 f€, e€  c0@ c0@ f€,€@ e€€€ c0 c0ÿÿÿÿÿÿÿÿÿÿÿÿÿüf€, ÿÿÿÿÿÿÿÿÿÿÿÿÿüe€ÿÿÿÿÿÿÿÿÿÿøc0 ÿÿÿÿÿÿÿÿÿÿøc0@ f€, e€ c0" ÿÿÿÿÿÿÿþ?ÿÿÿÿÿÀc0$ ÿÿÿÿÿÿÿñÿÿÿÿÿÿÀf€,H Àe€° ÀDDFcŒðÀ À@c2R1€ À@6fÖ-
Œ"É3ÀçÏ1˜º\d@‰.CÜÀÀNe“ZüR7)J”¥(JX$“R”A¹JP•©BÀH@FcR1ÿð P?)B”¥B “Ò”ùJ•éBÀH@^cR1üœ+)3€ç%1Ÿÿÿÿù8
“Ò”AYIœ•éCœÿÿÿÿ@Nf¹Œ,€
+)
…%X$
ÒAYHP¿iBÀ@Ne€#)J„¥(JX$’Ò‡ÑJPD£iBÀ\à>c0@Ì¢Æ3È„˜Ï1˜˜:\b1žD£.{ÒÀ@c0 Àf€, Àe€ ÀDDFc0 ÀDDFc0 Àf€, ÿüÿÿÿÿÿÿÿÿÿÿÿÀe€ ÿãÿÿÿÿÿÿÿÿÿÿÿÿÀc0 c0 f€, e€ÿÿÿÿÿÿÿÿÿÿøc0ÿÿÿÿÿÿÿÿÿÿøªªªªªªªªªªªc0@UUUUUUUUUUUf€, ªªªªªªªªªªªe€ UUUUUUUUUUUc0 
c0PUVf€, 
ª®e€PUVc0333330 
ª®c0333330330333P@f€,îîîîîà.îæîîîÀ¦ ÷âÉ3Ìù?êe€
ÝÝÝÝÝÐÝÝÝÝÀY0<12>7)J"‰c00303333¡<10>?)B"‰
™&c0@00Rá+)3Œ"‰ÅH&f€,@à,À¤<12>+)

ÿÿÿþˆFe€
ÐÀX<12>#)J$IH†c0 0¯8ñ"Æ3Ì$Iêc000`Pf€,à,À€ 
e€
ÐÀP@c000  
c0000PUVf€,à,ÀÀ 
ª®e€
ÐÀPUVc000  
ª®c0ƒ00UUUUUUUUUUUf€,Ng€KÌà,À`ªªªªªªªªªªªe€M<>JÐŒÿIÁ€UUUUUUUUUUUc0#ˆz2R kªªªªªªªªªªªc0#!Ž3<C5BD>00P {UVf€,zïÿÿÿ윢zમe€
ˆJÐRBYØUVc0b<00>JL02RB[ª®c00GK@fîîîìà,À` eÝÝÝÜ
ÐÀÿÿÿÿÿÿÿÿÿÿÿ€@c333000ÿÿÿÿÿÿÿÿÿÿÿ€ c333000À@`à,À`À `
ÐÀÀ@`00À `00€ÉàCÿ<43>É3Œ”¹€6`à,À`Ø @„Œ•*JR¥€²†`
ÐÀÈ „Œ• BR—¥€`00È@ „W [’—€¤`00È@„$¿
J<EFBFBD>%ÿÿÿÿH`à,ÀÈ€„$£)@•¥€°–`
ÐÀÜ€„' :Ld¹€^f`00À `333330333333À@`îîîîîà.îîîîîÀÀ `
ÝÝÝÝÝÐÝÝÝÝÝÀ@`333330333333À `À@`ÿÿÿÿÿÿÿÿÿÿÿ€ `ÿÿÿÿÿÿÿÿÿÿÿ€@` `@`ª®`UV`ª®`UV``ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿþ
Figure 19.3. Window Produced After Running SPY
This window is scrollable horizontally and vertically. This is useful, since the whole tree does not fit in the window. If a part that you want to see is not shown, you can scroll the window to show the part you want to see.
How to Use SPY from the Lisp Top Level
1
SPY(SPY NIL NIL NIL NIL 2 SUBNAME HOW% TO% USE SUBTEXT how% to% use) can also be run while a specific function or system is being used. To do this, type the function WITH.SPY(WITH.SPY (Function) NIL NIL NIL 2):
(WITH.SPY form)
The expression used for form should be the call to begin running the function or system that SPY is to watch. If you watch the SPY window, the eye will blink! To see your results, run the function SPY.TREE(SPY.TREE (Function) NIL NIL NIL 2). To do this, type:
(SPY.TREE)
The results of the last running of SPY will be displayed. If you do this, and SPY.TREE returns (no SPY samples have been gathered), your function ran too fast for SPY to follow.
Interpreting SPY's Results
1
Each node in the tree is a box that contains, first, the percentage of time spent running that particular function, and second, the function name. There are two modes that can be used to display this tree.(SPY NIL NIL NIL NIL 2 SUBNAME INTERPRETING% RESULTS SUBTEXT interpreting% results)
The default mode is cumulative. In this mode, each percentage is the amount of time that function spent on top of the stack, plus the amount of time spent by the functions it calls. The second mode is individual. To change the mode to individual, point to the title bar of the window, and press the middle mouse button. Choose Individual from the menu that appears. In this mode, the percentage shown is the amount of time the function spent on the top of the stack.
To look at a single branch of the tree, point with the mouse cursor at one of the nodes of the tree, and press the right mouse button. From the menu that appears, choose the option SubTree. Another SPY window will appear, with just this branch of the tree in it.
Another way to focus within the tree is to remove branches from the tree. To do this, point to the node at the top of the branch you would like to delete. Press the middle mouse button, and choose Delete from the menu that appears.
There are also different amounts of "merging" of functions that can be done in the window. A function can be called by another function more than once. The amount of merging determines where the subfunction, and the functions that it calls, appear in the tree, and how often. (For a detailed explanation of merging, see the Lisp Library Packages Manual.)
(LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "19-" "") STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "19-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (TEXT NIL NIL (54 54 504 690) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "19-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "19-" "")) (54 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "19-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "19-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL)))))-HHà
T,HHà
,,llà,HHà,HHà,HHà
-àT-àT,HHà,2àà5àÌàFøø PAGEHEADING VERSOHEADFøø PAGEHEADING RECTOHEADEøø PAGEHEADINGFOOTINGVEøø PAGEHEADINGFOOTINGR, CLASSIC
TITAN
CLASSIC HELVETICAMODERN HELVETICACLASSIC
 HELVETICA
MODERN

TIMESROMAN

TIMESROMAN
 HRULE.GETFNMODERN
 " HRULE.GETFNCLASSIC
#& HRULE.GETFNCLASSIC
% HRULE.GETFNCLASSIC


IM.CHAP.GETFN HELVETICA&  HRULE.GETFNMODERN 


IM.INDEX.GETFN­  # HRULE.GETFNCLASSIC 


%IM.INDEX.GETFN!(È BMOBJ.GETFN3
'IM.INDEX.GETFNLB*È BMOBJ.GETFN3CLASSIC


  >\H BMOBJ.GETFN3CLASSIC
+á ' HRULE.GETFNCLASSIC 
AIM.INDEX.GETFNb#IM.INDEX.GETFN C#IM.INDEX.GETFN #(
=    HRULE.GETFNCLASSICÍSIM.INDEX.GETFNTITAN
G
µ
>ÅD1³zº