Debian Codegraph @

doc/ref/chap7.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <head>
8 <title>GAP (ref) - Chapter 7: Debugging and Profiling Facilities</title>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10 <meta name="generator" content="GAPDoc2HTML" />
11 <link rel="stylesheet" type="text/css" href="manual.css" />
12 <script src="manual.js" type="text/javascript"></script>
13 <script type="text/javascript">overwriteStyle();</script>
14 </head>
15 <body class="chap7" onload="jscontent()">
16
17
18 <div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
19
20 <div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap6.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap8.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap7_mj.html">[MathJax on]</a></p>
23 <p><a id="X8345F6817DFD6394" name="X8345F6817DFD6394"></a></p>
24 <div class="ChapSects"><a href="chap7.html#X8345F6817DFD6394">7 <span class="Heading">Debugging and Profiling Facilities</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X83C45B0A797AAF96">7.1 <span class="Heading">Recovery from NoMethodFound-Errors</span></a>
26 </span>
27 <div class="ContSSBlock">
28 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X86B5FEC67A9394DC">7.1-1 ShowArguments</a></span>
29 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X834BD9928773DCC1">7.1-2 ShowArgument</a></span>
30 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7D25D904800D5CBA">7.1-3 ShowDetails</a></span>
31 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7F6996CA872478B8">7.1-4 ShowMethods</a></span>
32 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7E5E2E7B85029E34">7.1-5 ShowOtherMethods</a></span>
33 </div></div>
34 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X7FDA1D4B87BD25A8">7.2 <span class="Heading">Inspecting Applicable Methods</span></a>
35 </span>
36 <div class="ContSSBlock">
37 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X80848FF486BD6F9F">7.2-1 ApplicableMethod</a></span>
38 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7D88B5FE839FFD02">7.2-2 MethodsOperation</a></span>
39 </div></div>
40 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X7D43A2D885B37739">7.3 <span class="Heading">Tracing Methods</span></a>
41 </span>
42 <div class="ContSSBlock">
43 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X80B044017C9E4137">7.3-1 TraceMethods</a></span>
44 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7D34CADB813A4AF1">7.3-2 TraceAllMethods</a></span>
45 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7EB04D387C53E4C1">7.3-3 UntraceMethods</a></span>
46 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7B3018AA82D55949">7.3-4 UntraceAllMethods</a></span>
47 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X81078D3387A38E31">7.3-5 TraceImmediateMethods</a></span>
48 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X81B000CF86BA1534">7.3-6 TraceInternalMethods</a></span>
49 </div></div>
50 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X7A9C902479CB6F7C">7.4 <span class="Heading">Info Functions</span></a>
51 </span>
52 <div class="ContSSBlock">
53 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7AA1A1CF79F20790">7.4-1 NewInfoClass</a></span>
54 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7B3709C584B3DA1E">7.4-2 DeclareInfoClass</a></span>
55 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7A43B9E68765EE9E">7.4-3 SetInfoLevel</a></span>
56 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7B2ADC37783104B9">7.4-4 InfoLevel</a></span>
57 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7BA636EF80A1435A">7.4-5 ShowUsedInfoClasses</a></span>
58 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X864E4B6886E2697D">7.4-6 Info</a></span>
59 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X800234B5815CAC97">7.4-7 <span class="Heading">Customizing <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) statements</span></a>
60 </span>
61 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7A28F77C82D6A3E0">7.4-8 InfoWarning</a></span>
62 </div></div>
63 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X86425F067FC63A4C">7.5 <span class="Heading">Assertions</span></a>
64 </span>
65 <div class="ContSSBlock">
66 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7C7596418423660B">7.5-1 SetAssertionLevel</a></span>
67 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X876C83707F13A0FD">7.5-2 AssertionLevel</a></span>
68 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X830E443284780FB9">7.5-3 Assert</a></span>
69 </div></div>
70 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X792BA9A67E64CDED">7.6 <span class="Heading">Timing</span></a>
71 </span>
72 <div class="ContSSBlock">
73 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X80355C9282B35673">7.6-1 Runtimes</a></span>
74 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7E32B27F81870D24">7.6-2 Runtime</a></span>
75 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X844E1CFE80F41760">7.6-3 NanosecondsSinceEpoch</a></span>
76 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7C0F91F982189624">7.6-4 time</a></span>
77 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7B543F357C7202CF">7.6-5 Sleep</a></span>
78 </div></div>
79 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X844CB04081A771FB">7.7 <span class="Heading">Tracking Memory Usage</span></a>
80 </span>
81 <div class="ContSSBlock">
82 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X8077B50B844C4EFC">7.7-1 TotalMemoryAllocated</a></span>
83 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X8156D7208591460F">7.7-2 memory_allocated</a></span>
84 </div></div>
85 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X7FDF923D7D2937A1">7.8 <span class="Heading">Profiling</span></a>
86 </span>
87 <div class="ContSSBlock">
88 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7939F6F182FDA5F1">7.8-1 <span class="Heading">Function Profiling</span></a>
89 </span>
90 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X79D6CB927BBEB940">7.8-2 ProfileGlobalFunctions</a></span>
91 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7C893F68841B990B">7.8-3 ProfileOperations</a></span>
92 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X79D41E977DCA2BEE">7.8-4 ProfileOperationsAndMethods</a></span>
93 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X81E8A8627C34FD3B">7.8-5 ProfileFunctions</a></span>
94 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X79D394EC7BE8D008">7.8-6 UnprofileFunctions</a></span>
95 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X787AC3BE7F991344">7.8-7 ProfileMethods</a></span>
96 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X87A05F977F033693">7.8-8 UnprofileMethods</a></span>
97 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X80FEA6A08775A48E">7.8-9 DisplayProfile</a></span>
98 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7DAF9AB9793AE203">7.8-10 ClearProfile</a></span>
99 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7C5CE32579891120">7.8-11 <span class="Heading">An Example of Function Profiling</span></a>
100 </span>
101 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X812F9CE0817110EA">7.8-12 <span class="Heading">Line By Line Profiling</span></a>
102 </span>
103 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7E9C65B17B8EF993">7.8-13 <span class="Heading">Line by Line profiling example</span></a>
104 </span>
105 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X86557887796F66FA">7.8-14 ProfileLineByLine</a></span>
106 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X87CC48807DB4C008">7.8-15 CoverageLineByLine</a></span>
107 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7C5DED9C7CC77504">7.8-16 UnprofileLineByLine</a></span>
108 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7B705B2D8670A9C5">7.8-17 UncoverageLineByLine</a></span>
109 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7823C83D79B36D3B">7.8-18 IsLineByLineProfileActive</a></span>
110 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X83D8A42B7BB92F5B">7.8-19 DisplayCacheStats</a></span>
111 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X79C58704838232CC">7.8-20 ClearCacheStats</a></span>
112 </div></div>
113 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X7EE874867C0BEEDD">7.9 <span class="Heading">Information about the version used</span></a>
114 </span>
115 </div>
116 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X801051CC86594630">7.10 <span class="Heading">Test Files</span></a>
117 </span>
118 <div class="ContSSBlock">
119 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X8213757B7ACC76E6">7.10-1 <span class="Heading">Starting and stopping test</span></a>
120 </span>
121 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X87712F9D8732193C">7.10-2 Test</a></span>
122 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X87AF67528799481F">7.10-3 TestDirectory</a></span>
123 </div></div>
124 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X85FF55448787CCA0">7.11 <span class="Heading">Debugging Recursion</span></a>
125 </span>
126 <div class="ContSSBlock">
127 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7D8968FC7E24A4E5">7.11-1 SetRecursionTrapInterval</a></span>
128 </div></div>
129 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap7.html#X85679F17791D9B63">7.12 <span class="Heading">Global Memory Information</span></a>
130 </span>
131 <div class="ContSSBlock">
132 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7F1F741D7F0899D1">7.12-1 <span class="Heading">Garbage Collection</span></a>
133 </span>
134 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X7848AB367F3A1221">7.12-2 CollectGarbage</a></span>
135 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X836977DE80416F3D">7.12-3 GasmanStatistics</a></span>
136 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X85327FA5872E0356">7.12-4 GasmanMessageStatus</a></span>
137 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap7.html#X80C683247E94769F">7.12-5 GasmanLimits</a></span>
138 </div></div>
139 </div>
140
141 <h3>7 <span class="Heading">Debugging and Profiling Facilities</span></h3>
142
143 <p>This chapter describes some functions that are useful mainly for debugging and profiling purposes.</p>
144
145 <p>Probably the most important debugging tool in <strong class="pkg">GAP</strong> is the break loop (see Section <a href="chap6.html#X8593B49F8705B486"><span class="RefLink">6.4</span></a>) which can be entered by putting an <code class="func">Error</code> (<a href="chap6.html#X7E7AD8D87EBA1A08"><span class="RefLink">6.6-1</span></a>) statement into your code or by hitting Control-C. In the break loop one can inspect variables, stack traces and issue commands as usual in an interactive <strong class="pkg">GAP</strong> session. See also the <code class="func">DownEnv</code> (<a href="chap6.html#X79E66DA2875303B0"><span class="RefLink">6.5-1</span></a>), <code class="func">UpEnv</code> (<a href="chap6.html#X79E66DA2875303B0"><span class="RefLink">6.5-1</span></a>), <code class="func">Where</code> (<a href="chap6.html#X7A7FFA2B7C1EF5A3"><span class="RefLink">6.4-5</span></a>) and <code class="func">WhereWithVars</code> (<a href="chap6.html#X7A7FFA2B7C1EF5A3"><span class="RefLink">6.4-5</span></a>) functions.</p>
146
147 <p>Sections <a href="chap7.html#X7FDA1D4B87BD25A8"><span class="RefLink">7.2</span></a> and <a href="chap7.html#X7D43A2D885B37739"><span class="RefLink">7.3</span></a> show how to get information about the methods chosen by the method selection mechanism (see chapter <a href="chap78.html#X8058CC8187162644"><span class="RefLink">78</span></a>).</p>
148
149 <p>The final sections describe functions for collecting statistics about computations (see <code class="func">Runtime</code> (<a href="chap7.html#X7E32B27F81870D24"><span class="RefLink">7.6-2</span></a>), <a href="chap7.html#X7FDF923D7D2937A1"><span class="RefLink">7.8</span></a>).</p>
150
151 <p><a id="X83C45B0A797AAF96" name="X83C45B0A797AAF96"></a></p>
152
153 <h4>7.1 <span class="Heading">Recovery from NoMethodFound-Errors</span></h4>
154
155 <p>When the method selection fails because there is no applicable method, an error as in the following example occurs and a break loop is entered:</p>
156
157
158 <div class="example"><pre>
159 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsNormal(2,2);</span>
160 Error, no method found! For debugging hints type ?Recovery from NoMethodFound
161 Error, no 1st choice method found for `IsNormal' on 2 arguments
162 Stack trace:
163 called from read-eval loop at *stdin*:1
164 type 'quit;' to quit to outer loop
165 <span class="GAPbrkprompt">brk&gt;</span>
166 </pre></div>
167
168 <p>This only says, that the method selection tried to find a method for <code class="code">IsNormal</code> on two arguments and failed. In this situation it is crucial to find out, why this happened. Therefore there are a few functions which can display further information. Note that you can leave the break loop by the <code class="keyw">quit</code> command (see <a href="chap6.html#X83033EEB81CF4F49"><span class="RefLink">6.4-1</span></a>) and that the information about the incident is no longer accessible afterwards.</p>
169
170 <p><a id="X86B5FEC67A9394DC" name="X86B5FEC67A9394DC"></a></p>
171
172 <h5>7.1-1 ShowArguments</h5>
173
174 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowArguments</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
175 <p>This function is only available within a break loop caused by a <q>No Method Found</q>-error. It prints as a list the arguments of the operation call for which no method was found.</p>
176
177 <p><a id="X834BD9928773DCC1" name="X834BD9928773DCC1"></a></p>
178
179 <h5>7.1-2 ShowArgument</h5>
180
181 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowArgument</code>( <var class="Arg">nr</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
182 <p>This function is only available within a break loop caused by a <q>No Method Found</q>-error. It prints the <var class="Arg">nr</var>-th arguments of the operation call for which no method was found. <code class="func">ShowArgument</code> needs exactly one argument which is an integer between 0 and the number of arguments the operation was called with.</p>
183
184 <p><a id="X7D25D904800D5CBA" name="X7D25D904800D5CBA"></a></p>
185
186 <h5>7.1-3 ShowDetails</h5>
187
188 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowDetails</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
189 <p>This function is only available within a break loop caused by a <q>No Method Found</q>-error. It prints the details of this error: The operation, the number of arguments, a flag which indicates whether the operation is being traced, a flag which indicates whether the operation is a constructor method, and the number of methods that refused to apply by calling <code class="func">TryNextMethod</code> (<a href="chap78.html#X7EED949B83046A7F"><span class="RefLink">78.5-1</span></a>). The last number is called <code class="code">Choice</code> and is printed as an ordinal. So if exactly <span class="SimpleMath">k</span> methods were found but called <code class="func">TryNextMethod</code> (<a href="chap78.html#X7EED949B83046A7F"><span class="RefLink">78.5-1</span></a>) and there were no more methods it says <code class="code">Choice: </code><span class="SimpleMath">k</span><code class="code">th</code>.</p>
190
191 <p><a id="X7F6996CA872478B8" name="X7F6996CA872478B8"></a></p>
192
193 <h5>7.1-4 ShowMethods</h5>
194
195 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowMethods</code>( [<var class="Arg">verbosity</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
196 <p>This function is only available within a break loop caused by a <q>No Method Found</q>-error. It prints an overview about the installed methods for those arguments the operation was called with (using <a href="chap7.html#X7FDA1D4B87BD25A8"><span class="RefLink">7.2</span></a>. The verbosity can be controlled by the optional integer parameter <var class="Arg">verbosity</var>. The default is 2, which lists all applicable methods. With verbosity 1 <code class="func">ShowMethods</code> only shows the number of installed methods and the methods matching, which can only be those that were already called but refused to work by calling <code class="func">TryNextMethod</code> (<a href="chap78.html#X7EED949B83046A7F"><span class="RefLink">78.5-1</span></a>). With verbosity 3 not only all installed methods but also the reasons why they do not match are displayed.</p>
197
198 <p><a id="X7E5E2E7B85029E34" name="X7E5E2E7B85029E34"></a></p>
199
200 <h5>7.1-5 ShowOtherMethods</h5>
201
202 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowOtherMethods</code>( [<var class="Arg">verbosity</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
203 <p>This function is only available within a break loop caused by a <q>No Method Found</q>-error. It prints an overview about the installed methods for a different number of arguments than the number of arguments the operation was called with (using <a href="chap7.html#X7FDA1D4B87BD25A8"><span class="RefLink">7.2</span></a>. The verbosity can be controlled by the optional integer parameter <var class="Arg">verbosity</var>. The default is 1 which lists only the number of applicable methods. With verbosity 2 <code class="func">ShowOtherMethods</code> lists all installed methods and with verbosity 3 also the reasons, why they are not applicable. Calling <code class="func">ShowOtherMethods</code> with verbosity 3 in this function will normally not make any sense, because the different numbers of arguments are simulated by supplying the corresponding number of ones, for which normally no reasonable methods will be installed.</p>
204
205 <p><a id="X7FDA1D4B87BD25A8" name="X7FDA1D4B87BD25A8"></a></p>
206
207 <h4>7.2 <span class="Heading">Inspecting Applicable Methods</span></h4>
208
209 <p><a id="X80848FF486BD6F9F" name="X80848FF486BD6F9F"></a></p>
210
211 <h5>7.2-1 ApplicableMethod</h5>
212
213 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ApplicableMethod</code>( <var class="Arg">opr</var>, <var class="Arg">args</var>[, <var class="Arg">printlevel</var>[, <var class="Arg">nr</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
214 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ApplicableMethodTypes</code>( <var class="Arg">opr</var>, <var class="Arg">args</var>[, <var class="Arg">printlevel</var>[, <var class="Arg">nr</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
215 <p>Called with two arguments, <code class="func">ApplicableMethod</code> returns the method of highest rank that is applicable for the operation <var class="Arg">opr</var> with the arguments in the list <var class="Arg">args</var>. The default <var class="Arg">printlevel</var> is <code class="code">0</code>. If no method is applicable then <code class="keyw">fail</code> is returned.</p>
216
217 <p>If a positive integer is given as the fourth argument <var class="Arg">nr</var> then <code class="func">ApplicableMethod</code> returns the <var class="Arg">nr</var>-th applicable method for the operation <var class="Arg">opr</var> with the arguments in the list <var class="Arg">args</var>, where the methods are ordered according to descending rank. If less than <var class="Arg">nr</var> methods are applicable then <code class="keyw">fail</code> is returned.</p>
218
219 <p>If the fourth argument <var class="Arg">nr</var> is the string <code class="code">"all"</code> then <code class="func">ApplicableMethod</code> returns a list of all applicable methods for <var class="Arg">opr</var> with arguments <var class="Arg">args</var>, ordered according to descending rank.</p>
220
221 <p>Depending on the integer value <var class="Arg">printlevel</var>, additional information is printed. Admissible values and their meaning are as follows.</p>
222
223
224 <dl>
225 <dt><strong class="Mark">0</strong></dt>
226 <dd><p>no information,</p>
227
228 </dd>
229 <dt><strong class="Mark">1</strong></dt>
230 <dd><p>information about the applicable method,</p>
231
232 </dd>
233 <dt><strong class="Mark">2</strong></dt>
234 <dd><p>also information about the not applicable methods of higher rank,</p>
235
236 </dd>
237 <dt><strong class="Mark">3</strong></dt>
238 <dd><p>also for each not applicable method the first reason why it is not applicable,</p>
239
240 </dd>
241 <dt><strong class="Mark">4</strong></dt>
242 <dd><p>also for each not applicable method all reasons why it is not applicable.</p>
243
244 </dd>
245 <dt><strong class="Mark">6</strong></dt>
246 <dd><p>also the function body of the selected method(s)</p>
247
248 </dd>
249 </dl>
250 <p>When a method returned by <code class="func">ApplicableMethod</code> is called then it returns either the desired result or the string <code class="code">"TRY_NEXT_METHOD"</code>, which corresponds to a call to <code class="func">TryNextMethod</code> (<a href="chap78.html#X7EED949B83046A7F"><span class="RefLink">78.5-1</span></a>) in the method and means that the method selection would call the next applicable method.</p>
251
252 <p><em>Note:</em> The <strong class="pkg">GAP</strong> kernel provides special treatment for the infix operations <code class="code">\+</code>, <code class="code">\-</code>, <code class="code">\*</code>, <code class="code">\/</code>, <code class="code">\^</code>, <code class="code">\mod</code> and <code class="code">\in</code>. For some kernel objects (notably cyclotomic numbers, finite field elements and row vectors thereof) it calls kernel methods circumventing the method selection mechanism. Therefore for these operations <code class="func">ApplicableMethod</code> may return a method which is not the kernel method actually used.</p>
253
254 <p>The function <code class="func">ApplicableMethodTypes</code> takes the <em>types</em> or <em>filters</em> of the arguments as argument (if only filters are given of course family predicates cannot be tested).</p>
255
256 <p><a id="X7D88B5FE839FFD02" name="X7D88B5FE839FFD02"></a></p>
257
258 <h5>7.2-2 MethodsOperation</h5>
259
260 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MethodsOperation</code>( <var class="Arg">oper</var>, <var class="Arg">n</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
261 <p>Return a list of records that describe the installed methods for the operation <var class="Arg">oper</var>, with <var class="Arg">n</var> arguments.</p>
262
263 <p>Each record has at least the following components.</p>
264
265
266 <dl>
267 <dt><strong class="Mark">func</strong></dt>
268 <dd><p>the method itself, a <strong class="pkg">GAP</strong> function,</p>
269
270 </dd>
271 <dt><strong class="Mark">rank</strong></dt>
272 <dd><p>the rank of the method, an integer or infinity,</p>
273
274 </dd>
275 <dt><strong class="Mark">info</strong></dt>
276 <dd><p>a string that describes when the method is applicable,</p>
277
278 </dd>
279 <dt><strong class="Mark">location</strong></dt>
280 <dd><p>filename and start line where the method gets installed.</p>
281
282 </dd>
283 </dl>
284 <p><a id="X7D43A2D885B37739" name="X7D43A2D885B37739"></a></p>
285
286 <h4>7.3 <span class="Heading">Tracing Methods</span></h4>
287
288 <p><a id="X80B044017C9E4137" name="X80B044017C9E4137"></a></p>
289
290 <h5>7.3-1 TraceMethods</h5>
291
292 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TraceMethods</code>( <var class="Arg">opr1</var>, <var class="Arg">opr2</var>, <var class="Arg">...</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
293 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TraceMethods</code>( <var class="Arg">oprs</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
294 <p>After the call of <code class="code">TraceMethods</code>, whenever a method of one of the operations <var class="Arg">opr1</var>, <var class="Arg">opr2</var>, ... is called, the information string used in the installation of the method is printed. The second form has the same effect for each operation from the list <var class="Arg">oprs</var> of operations.</p>
295
296 <p><a id="X7D34CADB813A4AF1" name="X7D34CADB813A4AF1"></a></p>
297
298 <h5>7.3-2 TraceAllMethods</h5>
299
300 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TraceAllMethods</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
301 <p>Invokes <code class="code">TraceMethods</code> for all operations.</p>
302
303 <p><a id="X7EB04D387C53E4C1" name="X7EB04D387C53E4C1"></a></p>
304
305 <h5>7.3-3 UntraceMethods</h5>
306
307 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UntraceMethods</code>( <var class="Arg">opr1</var>, <var class="Arg">opr2</var>, <var class="Arg">...</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
308 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UntraceMethods</code>( <var class="Arg">oprs</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
309 <p>turns the tracing off for all operations <var class="Arg">opr1</var>, <var class="Arg">opr2</var>, ... or in the second form, for all operations in the list <var class="Arg">oprs</var>.</p>
310
311
312 <div class="example"><pre>
313 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">TraceMethods( [ Size ] );</span>
314 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:= Group( (1,2,3), (1,2) );;</span>
315 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size( g );</span>
316 #I Size: for a permutation group at /gap5/lib/grpperm.gi:487
317 #I Setter(Size): system setter
318 #I Size: system getter
319 #I Size: system getter
320 6
321 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UntraceMethods( [ Size ] );</span>
322 </pre></div>
323
324 <p><a id="X7B3018AA82D55949" name="X7B3018AA82D55949"></a></p>
325
326 <h5>7.3-4 UntraceAllMethods</h5>
327
328 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UntraceAllMethods</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
329 <p>Equivalent to calling <code class="code">UntraceMethods</code> for all operations.</p>
330
331 <p><a id="X81078D3387A38E31" name="X81078D3387A38E31"></a></p>
332
333 <h5>7.3-5 TraceImmediateMethods</h5>
334
335 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TraceImmediateMethods</code>( [<var class="Arg">flag</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
336 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UntraceImmediateMethods</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
337 <p><code class="func">TraceImmediateMethods</code> enables tracing for all immediate methods if <var class="Arg">flag</var> is either <code class="keyw">true</code>, or not present. <code class="func">UntraceImmediateMethods</code>, or <code class="func">TraceImmediateMethods</code> with <var class="Arg">flag</var> equal <code class="keyw">false</code> turns tracing off. (There is no facility to trace <em>specific</em> immediate methods.)</p>
338
339
340 <div class="example"><pre>
341 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">TraceImmediateMethods( );</span>
342 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:= Group( (1,2,3), (1,2) );;</span>
343 #I RunImmediateMethods
344 #I immediate: Size
345 #I immediate: IsCyclic
346 #I immediate: IsCommutative
347 #I immediate: IsTrivial
348 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size( g );</span>
349 #I immediate: IsPerfectGroup
350 #I immediate: IsNonTrivial
351 #I immediate: Size
352 #I immediate: IsFreeAbelian
353 #I immediate: IsTorsionFree
354 #I immediate: IsNonTrivial
355 #I immediate: IsPerfectGroup
356 #I immediate: GeneralizedPcgs
357 #I immediate: IsEmpty
358 6
359 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UntraceImmediateMethods( );</span>
360 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UntraceMethods( [ Size ] );</span>
361 </pre></div>
362
363 <p>This example gives an explanation for the two calls of the <q>system getter</q> for <code class="func">Size</code> (<a href="chap30.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>). Namely, there are immediate methods that access the known size of the group. Note that the group <code class="code">g</code> was known to be finitely generated already before the size was computed, the calls of the immediate method for <code class="func">IsFinitelyGeneratedGroup</code> (<a href="chap39.html#X81E22D07871DF37E"><span class="RefLink">39.15-18</span></a>) after the call of <code class="func">Size</code> (<a href="chap30.html#X858ADA3B7A684421"><span class="RefLink">30.4-6</span></a>) have other arguments than <code class="code">g</code>.</p>
364
365 <p><a id="X81B000CF86BA1534" name="X81B000CF86BA1534"></a></p>
366
367 <h5>7.3-6 TraceInternalMethods</h5>
368
369 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TraceInternalMethods</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
370 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UntraceInternalMethods</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
371 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GetTraceInternalMethodsCounts</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
372 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ClearTraceInternalMethodsCounts</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
373 <p><code class="func">TraceInternalMethods</code> enables tracing for all internal methods. Internal methods are methods which implement many fundamental operations in GAP. In this version of GAP, the internal methods which can be traced are:</p>
374
375
376 <dl>
377 <dt><strong class="Mark">Zero, ZeroMut</strong></dt>
378 <dd><p>Mutable and Immutable <code class="func">Zero</code> (<a href="chap31.html#X8040AC7A79FFC442"><span class="RefLink">31.10-3</span></a>)</p>
379
380 </dd>
381 <dt><strong class="Mark">AInv, AInvMut</strong></dt>
382 <dd><p>Mutable and Immutable <code class="func">AdditiveInverse</code> (<a href="chap31.html#X84BB723C81D55D63"><span class="RefLink">31.10-9</span></a>)</p>
383
384 </dd>
385 <dt><strong class="Mark">One, OneMut</strong></dt>
386 <dd><p>Mutable and Immutable <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>)</p>
387
388 </dd>
389 <dt><strong class="Mark">Inv, InvMut</strong></dt>
390 <dd><p>Mutable and Immutable <code class="func">Inverse</code> (<a href="chap31.html#X78EE524E83624057"><span class="RefLink">31.10-8</span></a>)</p>
391
392 </dd>
393 <dt><strong class="Mark">Sum</strong></dt>
394 <dd><p>The operator <code class="func">\+</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>)</p>
395
396 </dd>
397 <dt><strong class="Mark">Diff</strong></dt>
398 <dd><p>The operator <code class="code">-</code> operator</p>
399
400 </dd>
401 <dt><strong class="Mark">Prod</strong></dt>
402 <dd><p>The operator <code class="func">\*</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>)</p>
403
404 </dd>
405 <dt><strong class="Mark">Quo</strong></dt>
406 <dd><p>The operator <code class="func">\/</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>)</p>
407
408 </dd>
409 <dt><strong class="Mark">LQuo</strong></dt>
410 <dd><p>The left-quotient operator</p>
411
412 </dd>
413 <dt><strong class="Mark">Pow</strong></dt>
414 <dd><p>The operator <code class="func">\^</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>)</p>
415
416 </dd>
417 <dt><strong class="Mark">Comm</strong></dt>
418 <dd><p>The operator <code class="func">Comm</code> (<a href="chap31.html#X80761843831B468E"><span class="RefLink">31.12-3</span></a>)</p>
419
420 </dd>
421 <dt><strong class="Mark">Mod</strong></dt>
422 <dd><p>The operator <code class="func">\mod</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>)</p>
423
424 </dd>
425 </dl>
426 <p><code class="func">UntraceInternalMethods</code> turns tracing off. As these methods can be called hundreds of thousands of times in simple GAP code, there isn't a statement printed each time one is called. Instead, the method <code class="func">GetTraceInternalMethodsCounts</code> returns how many times each operation has been applied to each type of variable (the type of a variable can be found with the <code class="code">TNAM_OBJ</code> method). The return value for two argument operators is a record of records <code class="code">r</code>, where <code class="code">r.op</code> stores information about operator <code class="code">op</code>. For one argument operators <code class="code">r.op.i</code> stores how many times <code class="code">op</code> was called with an argument of type <code class="code">i</code>, while for two argument operators <code class="code">r.op.i.j</code> stores how many times <code class="code">op</code> was called with arguments of type <code class="code">i</code> and <code class="code">j</code>.</p>
427
428
429 <div class="example"><pre>
430 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">TraceInternalMethods();</span>
431 true
432 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">2+3+4+5+6;;</span>
433 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">2.0+2.0;;</span>
434 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">3^(1,2,3);;</span>
435 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GetTraceInternalMethodsCounts();</span>
436 rec( Pow := rec( integer := rec( ("permutation (small)") := 1 ) ),
437 Sum := rec( integer := rec( integer := 4 ),
438 macfloat := rec( macfloat := 1 ) ) )
439 # 'macfloat' is a floating point number
440 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UntraceInternalMethods();</span>
441 </pre></div>
442
443 <p><a id="X7A9C902479CB6F7C" name="X7A9C902479CB6F7C"></a></p>
444
445 <h4>7.4 <span class="Heading">Info Functions</span></h4>
446
447 <p>The <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) mechanism permits operations to display intermediate results or information about the progress of the algorithms. Information is always given according to one or more <em>info classes</em>. Each of the info classes defined in the <strong class="pkg">GAP</strong> library usually covers a certain range of algorithms, so for example <code class="code">InfoLattice</code> covers all the cyclic extension algorithms for the computation of a subgroup lattice.</p>
448
449 <p>Note that not all info classes defined in the <strong class="pkg">GAP</strong> library are currently documented. Many <strong class="pkg">GAP</strong> packages define additional info classes, which are typically documented in the corresponding package documentation. The function <code class="func">ShowUsedInfoClasses</code> (<a href="chap7.html#X7BA636EF80A1435A"><span class="RefLink">7.4-5</span></a>) will show all info classes which <strong class="pkg">GAP</strong> considers while executing code.</p>
450
451 <p>The amount of information to be displayed by each info class can be separately specified by the user. This is done by selecting a non-negative integer <em>level</em> for the info class: no information will be displayed at level 0, and the higher the level, the more information that will be displayed. At creation, an info class has level 0. By default, all built-in GAP info classes have level 0, except for the following info classes, which have level 1:</p>
452
453
454 <ul>
455 <li><p><code class="func">InfoWarning</code> (<a href="chap7.html#X7A28F77C82D6A3E0"><span class="RefLink">7.4-8</span></a>),</p>
456
457 </li>
458 <li><p><code class="func">InfoPackageLoading</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>),</p>
459
460 </li>
461 <li><p><code class="code">InfoDebug</code>,</p>
462
463 </li>
464 <li><p><code class="code">InfoPerformance</code>,</p>
465
466 </li>
467 <li><p><code class="code">InfoTempDirectories</code>,</p>
468
469 </li>
470 <li><p><code class="code">InfoPrimeInt</code>, and</p>
471
472 </li>
473 <li><p><code class="code">InfoSLP</code>.</p>
474
475 </li>
476 </ul>
477 <p><a id="X7AA1A1CF79F20790" name="X7AA1A1CF79F20790"></a></p>
478
479 <h5>7.4-1 NewInfoClass</h5>
480
481 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NewInfoClass</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
482 <p>creates a new info class with name <var class="Arg">name</var>.</p>
483
484 <p><a id="X7B3709C584B3DA1E" name="X7B3709C584B3DA1E"></a></p>
485
486 <h5>7.4-2 DeclareInfoClass</h5>
487
488 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareInfoClass</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
489 <p>creates a new info class with name <var class="Arg">name</var> and binds it to the global variable <var class="Arg">name</var>. The variable must previously be writable, and is made read-only by this function.</p>
490
491 <p><a id="X7A43B9E68765EE9E" name="X7A43B9E68765EE9E"></a></p>
492
493 <h5>7.4-3 SetInfoLevel</h5>
494
495 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetInfoLevel</code>( <var class="Arg">infoclass</var>, <var class="Arg">level</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
496 <p>Sets the info level for <var class="Arg">infoclass</var> to the non-negative integer <var class="Arg">level</var>.</p>
497
498 <p><a id="X7B2ADC37783104B9" name="X7B2ADC37783104B9"></a></p>
499
500 <h5>7.4-4 InfoLevel</h5>
501
502 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoLevel</code>( <var class="Arg">infoclass</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
503 <p>returns the info level of <var class="Arg">infoclass</var>.</p>
504
505 <p><a id="X7BA636EF80A1435A" name="X7BA636EF80A1435A"></a></p>
506
507 <h5>7.4-5 ShowUsedInfoClasses</h5>
508
509 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowUsedInfoClasses</code>( <var class="Arg">infoclass</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
510 <p>Called with argument <code class="keyw">true</code>, this makes <strong class="pkg">GAP</strong> print the info class and level of any executed <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) statement. Calling with the argument <code class="keyw">false</code> stops this printing. Each level of each info class is only printed once. The history of printed info classes and levels is reset whenever <code class="keyw">true</code> is passed.</p>
511
512
513 <div class="example"><pre>
514 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ShowUsedInfoClasses(true);</span>
515 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Intersection(Group((1,3,2,4,5,6)), Group((1,2,3,4,5,6)));</span>
516 #I Would print info with SetInfoLevel(InfoBckt,1)
517 #I Would print info with SetInfoLevel(InfoBckt,3)
518 #I Would print info with SetInfoLevel(InfoBckt,5)
519 Group(())
520 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Intersection(Group((1,3,2,4,5,6)), Group((1,2,3,4,5,6)));</span>
521 Group(())
522 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ShowUsedInfoClasses(false);</span>
523 </pre></div>
524
525 <p><a id="X864E4B6886E2697D" name="X864E4B6886E2697D"></a></p>
526
527 <h5>7.4-6 Info</h5>
528
529 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Info</code>( <var class="Arg">infoclass</var>, <var class="Arg">level</var>, <var class="Arg">info</var>[, <var class="Arg">moreinfo</var>, <var class="Arg">...</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
530 <p>If the info level of <var class="Arg">infoclass</var> is at least <var class="Arg">level</var>, then the remaining arguments, <var class="Arg">info</var>, and possibly <var class="Arg">moreinfo</var> and so on, are evaluated. (Technically, <code class="func">Info</code> is a keyword and not a function.)</p>
531
532 <p>By default, the results of these evaluations are viewed, preceded by the string <code class="code">"#I "</code> and followed by a newline.</p>
533
534 <p>If the info level of <var class="Arg">infoclass</var> is strictly less than <var class="Arg">level</var>, then the third and subsequent arguments are not evaluated. (The latter can save substantial time when displaying difficult results.)</p>
535
536 <p>The behaviour can be customized with <code class="func">SetInfoHandler</code> (<a href="chap7.html#X800234B5815CAC97"><span class="RefLink">7.4-7</span></a>).</p>
537
538
539 <div class="example"><pre>
540 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">InfoExample:=NewInfoClass("InfoExample");;</span>
541 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample,1,"one");Info(InfoExample,2,"two");</span>
542 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetInfoLevel(InfoExample,1);</span>
543 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample,1,"one");Info(InfoExample,2,"two");</span>
544 #I one
545 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetInfoLevel(InfoExample,2);</span>
546 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample,1,"one");Info(InfoExample,2,"two");</span>
547 #I one
548 #I two
549 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">InfoLevel(InfoExample);</span>
550 2
551 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample,3,Length(Combinations([1..9999])));</span>
552 </pre></div>
553
554 <p>Note that the last <code class="func">Info</code> call is executed without problems, since the actual level <code class="code">2</code> of <code class="code">InfoExample</code> causes <code class="func">Info</code> to ignore the last argument, which prevents <code class="code">Length(Combinations([1..9999]))</code> from being evaluated; note that an evaluation would be impossible due to memory restrictions.</p>
555
556 <p>A set of info classes (called an <em>info selector</em>) may be passed to a single <code class="func">Info</code> statement. As a shorthand, info classes and selectors may be combined with <code class="code">+</code> rather than <code class="func">Union</code> (<a href="chap30.html#X799F0E2F7A502DBA"><span class="RefLink">30.5-3</span></a>). In this case, the message is triggered if the level of <em>any</em> of the classes is high enough.</p>
557
558
559 <div class="example"><pre>
560 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">InfoExample:=NewInfoClass("InfoExample");;</span>
561 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetInfoLevel(InfoExample,0);</span>
562 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample + InfoWarning, 1, "hello");</span>
563 #I hello
564 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample + InfoWarning, 2, "hello");</span>
565 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetInfoLevel(InfoExample,2);</span>
566 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Info(InfoExample + InfoWarning, 2, "hello");</span>
567 #I hello
568 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">InfoLevel(InfoWarning);</span>
569 1
570 </pre></div>
571
572 <p><a id="X800234B5815CAC97" name="X800234B5815CAC97"></a></p>
573
574 <h5>7.4-7 <span class="Heading">Customizing <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) statements</span></h5>
575
576 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetInfoHandler</code>( <var class="Arg">infoclass</var>, <var class="Arg">handler</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
577 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetInfoOutput</code>( <var class="Arg">infoclass</var>, <var class="Arg">out</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
578 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnbindInfoOutput</code>( <var class="Arg">infoclass</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
579 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoOutput</code>( <var class="Arg">infoclass</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
580 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetDefaultInfoOutput</code>( <var class="Arg">out</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
581 <p>Returns: nothing</p>
582
583 <p>This allows one to customize what happens in an <code class="code">Info(<var class="Arg">infoclass</var>, <var class="Arg">level</var>, ...)</code> statement.</p>
584
585 <p>In the first function, <var class="Arg">handler</var> must be a function with three arguments <var class="Arg">infoclass</var>, <var class="Arg">level</var>, <var class="Arg">list</var>. Here <var class="Arg">list</var> is the list containing the third argument and any subsequent optional arguments of the <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) call.</p>
586
587 <p>The default handler is the function <code class="code">DefaultInfoHandler</code>. It prints <code class="code">"#I "</code>, then the third and further arguments of the info statement, and finally a <code class="code">"\n"</code>.</p>
588
589 <p>If the first argument of an <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) statement is a sum of Info classes, the handler of the first summand is used.</p>
590
591 <p>The file or stream to which <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) statements for individual <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) classes print can be overridden with <code class="func">SetInfoOutput</code>, retrieved with <code class="func">InfoOutput</code> and reset to the default with <code class="func">UnbindInfoOutput</code>. The initial default for all <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) classes is the string <code class="code">"*Print*"</code> which means the current output file. The default can be changed with <code class="func">SetDefaultInfoOutput</code>. The argument <var class="Arg">out</var> can be a filename or an open stream, the special names <code class="code">"*Print*"</code>, <code class="code">"*errout*</code> and <code class="code">"*stdout*</code> are also recognized.</p>
592
593 <p>For example, <code class="code">SetDefaultInfoOutput("*errout*");</code> would send <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) output to standard error, which can be interesting if <strong class="pkg">GAP</strong>s output is redirected.</p>
594
595 <p><a id="X7A28F77C82D6A3E0" name="X7A28F77C82D6A3E0"></a></p>
596
597 <h5>7.4-8 InfoWarning</h5>
598
599 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoWarning</code></td><td class="tdright">(&nbsp;info class&nbsp;)</td></tr></table></div>
600 <p>is an info class to which general warnings are sent at level 1, which is its default level. More specialised warnings are shown via calls of <code class="func">Info</code> (<a href="chap7.html#X864E4B6886E2697D"><span class="RefLink">7.4-6</span></a>) at <code class="func">InfoWarning</code> level 2, e.g. information about the autoloading of <strong class="pkg">GAP</strong> packages and the initial line matched when displaying an on-line help topic.</p>
601
602 <p><a id="X86425F067FC63A4C" name="X86425F067FC63A4C"></a></p>
603
604 <h4>7.5 <span class="Heading">Assertions</span></h4>
605
606 <p>Assertions are used to find errors in algorithms. They test whether intermediate results conform to required conditions and issue an error if not.</p>
607
608 <p><a id="X7C7596418423660B" name="X7C7596418423660B"></a></p>
609
610 <h5>7.5-1 SetAssertionLevel</h5>
611
612 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetAssertionLevel</code>( <var class="Arg">lev</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
613 <p>assigns the global assertion level to <var class="Arg">lev</var>. By default it is zero.</p>
614
615 <p><a id="X876C83707F13A0FD" name="X876C83707F13A0FD"></a></p>
616
617 <h5>7.5-2 AssertionLevel</h5>
618
619 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AssertionLevel</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
620 <p>returns the current assertion level.</p>
621
622 <p><a id="X830E443284780FB9" name="X830E443284780FB9"></a></p>
623
624 <h5>7.5-3 Assert</h5>
625
626 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Assert</code>( <var class="Arg">lev</var>, <var class="Arg">cond</var>[, <var class="Arg">message</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
627 <p>With two arguments, if the global assertion level is at least <var class="Arg">lev</var>, condition <var class="Arg">cond</var> is tested and if it does not return <code class="keyw">true</code> an error is raised. Thus <code class="code">Assert(lev, <var class="Arg">cond</var>)</code> is equivalent to the code</p>
628
629
630 <div class="example"><pre>
631 if AssertionLevel() &gt;= lev and not &lt;cond&gt; then
632 Error("Assertion failure");
633 fi;
634 </pre></div>
635
636 <p>If the <var class="Arg">message</var> argument form of the <code class="func">Assert</code> statement is provided, and if an error is raised, then this message is printed as part of the error.</p>
637
638 <p>Assertions are used at various places in the library. Thus turning assertions on can slow code execution significantly.</p>
639
640 <p><a id="X792BA9A67E64CDED" name="X792BA9A67E64CDED"></a></p>
641
642 <h4>7.6 <span class="Heading">Timing</span></h4>
643
644 <p><a id="X80355C9282B35673" name="X80355C9282B35673"></a></p>
645
646 <h5>7.6-1 Runtimes</h5>
647
648 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Runtimes</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
649 <p><code class="func">Runtimes</code> returns a record with components bound to integers or <code class="keyw">fail</code>. Each integer is the cpu time (processor time) in milliseconds spent by <strong class="pkg">GAP</strong> in a certain status:</p>
650
651
652 <dl>
653 <dt><strong class="Mark"><code class="code">user_time</code></strong></dt>
654 <dd><p>cpu time spent with <strong class="pkg">GAP</strong> functions (without child processes).</p>
655
656 </dd>
657 <dt><strong class="Mark"><code class="code">system_time</code></strong></dt>
658 <dd><p>cpu time spent in system calls, e.g., file access (<code class="keyw">fail</code> if not available).</p>
659
660 </dd>
661 <dt><strong class="Mark"><code class="code">user_time_children</code></strong></dt>
662 <dd><p>cpu time spent in child processes (<code class="keyw">fail</code> if not available).</p>
663
664 </dd>
665 <dt><strong class="Mark"><code class="code">system_time_children</code></strong></dt>
666 <dd><p>cpu time spent in system calls by child processes (<code class="keyw">fail</code> if not available).</p>
667
668 </dd>
669 </dl>
670 <p>Note that this function is not fully supported on all systems. Only the <code class="code">user_time</code> component is (and may on some systems include the system time).</p>
671
672 <p>The following example demonstrates tasks which contribute to the different time components:</p>
673
674
675 <div class="example"><pre>
676 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Runtimes(); # after startup</span>
677 rec( user_time := 3980, system_time := 60, user_time_children := 0,
678 system_time_children := 0 )
679 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Exec("cat /usr/bin/*||wc"); # child process with a lot of file access</span>
680 893799 7551659 200928302
681 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Runtimes();</span>
682 rec( user_time := 3990, system_time := 60, user_time_children := 1590,
683 system_time_children := 600 )
684 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">a:=0;;for i in [1..100000000] do a:=a+1; od; # GAP user time</span>
685 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Runtimes();</span>
686 rec( user_time := 12980, system_time := 70, user_time_children := 1590,
687 system_time_children := 600 )
688 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">?blabla # first call of help, a lot of file access</span>
689 Help: no matching entry found
690 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Runtimes();</span>
691 rec( user_time := 13500, system_time := 440, user_time_children := 1590,
692 system_time_children := 600 )
693 </pre></div>
694
695 <p><a id="X7E32B27F81870D24" name="X7E32B27F81870D24"></a></p>
696
697 <h5>7.6-2 Runtime</h5>
698
699 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Runtime</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
700 <p><code class="func">Runtime</code> returns the time spent by <strong class="pkg">GAP</strong> in milliseconds as an integer. It is the same as the value of the <code class="code">user_time</code> component given by <code class="func">Runtimes</code> (<a href="chap7.html#X80355C9282B35673"><span class="RefLink">7.6-1</span></a>), as explained above.</p>
701
702 <p>See <code class="func">StringTime</code> (<a href="chap27.html#X802469C47F886A59"><span class="RefLink">27.10-9</span></a>) for a translation from milliseconds into hour/minute format.</p>
703
704 <p><a id="X844E1CFE80F41760" name="X844E1CFE80F41760"></a></p>
705
706 <h5>7.6-3 NanosecondsSinceEpoch</h5>
707
708 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NanosecondsSinceEpoch</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
709 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NanosecondsSinceEpochInfo</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
710 <p><code class="func">NanosecondsSinceEpoch</code> returns the time in nanoseconds that has passed since some fixed, but unspecified time in the past. This function is appropriate for doing wallclock time measurements. The actual resolution depends on the system that <strong class="pkg">GAP</strong> is run on. Information about the used timers can be obtained by calling <code class="func">NanosecondsSinceEpochInfo</code>, which returns a record containing members <code class="code">Method</code>, <code class="code">Monotonic</code>, <code class="code">Reliable</code> and <code class="code">Resolution</code>.</p>
711
712 <p><code class="code">Method</code> is a string describing the method used to obtain timer values. This will usually contain the name of the syscall used.</p>
713
714 <p><code class="code">Monotonic</code> is a boolean. If it is <code class="keyw">true</code>, then the values returned by <code class="func">NanosecondsSinceEpoch</code> are guaranteed to be strictly monotonically increasing between two calls, if it is <code class="keyw">false</code> then there is no such guarantee.</p>
715
716 <p><code class="code">Resolution</code> is an integer reflecting the resolution of the timer used in nanoseconds.</p>
717
718 <p><code class="code">Reliable</code> is a boolean. If it is <code class="keyw">true</code> then the value <code class="code">Resolution</code> is deemed reliable in the sense that it was obtained by querying the operating system, otherwise <code class="code">Resolution</code> should be treated as an estimate.</p>
719
720 <p><a id="X7C0F91F982189624" name="X7C0F91F982189624"></a></p>
721
722 <h5>7.6-4 time</h5>
723
724 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; time</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
725 <p>In the read-eval-print loop, <code class="func">time</code> stores the number of milliseconds the last command took (see also <code class="func">memory_allocated</code> (<a href="chap7.html#X8156D7208591460F"><span class="RefLink">7.7-2</span></a>) for the number of bytes of memory it allocated).</p>
726
727 <p><a id="X7B543F357C7202CF" name="X7B543F357C7202CF"></a></p>
728
729 <h5>7.6-5 Sleep</h5>
730
731 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Sleep</code>( <var class="Arg">time</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
732 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MicroSleep</code>( <var class="Arg">time</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
733 <p>These functions make GAP stop execution for a given period of time. The time to stop is given to <code class="func">Sleep</code> in seconds and <code class="func">MicroSleep</code> in microseconds.</p>
734
735 <p><a id="X844CB04081A771FB" name="X844CB04081A771FB"></a></p>
736
737 <h4>7.7 <span class="Heading">Tracking Memory Usage</span></h4>
738
739 <p><a id="X8077B50B844C4EFC" name="X8077B50B844C4EFC"></a></p>
740
741 <h5>7.7-1 TotalMemoryAllocated</h5>
742
743 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TotalMemoryAllocated</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
744 <p><code class="func">TotalMemoryAllocated</code> returns the total amount of memory in bytes allocated by the <strong class="pkg">GAP</strong> memory manager since <strong class="pkg">GAP</strong> started.</p>
745
746 <p><a id="X8156D7208591460F" name="X8156D7208591460F"></a></p>
747
748 <h5>7.7-2 memory_allocated</h5>
749
750 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; memory_allocated</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
751 <p>In the read-eval-print loop, <code class="func">memory_allocated</code> stores the number of bytes of memory allocated by the last completed statement (see also <code class="func">time</code> (<a href="chap7.html#X7C0F91F982189624"><span class="RefLink">7.6-4</span></a>) for the number of milliseconds it took).</p>
752
753 <p><a id="X7FDF923D7D2937A1" name="X7FDF923D7D2937A1"></a></p>
754
755 <h4>7.8 <span class="Heading">Profiling</span></h4>
756
757 <p>Profiling of code can be used to determine in which parts of a program how much time has been spent and how much memory has been allocated during runtime. GAP has two different methods of profiling. GAP can either profile by function, or line-by-line. Line by line profiling is currently only used for code coverage, while function profiling tracks memory and time usage.</p>
758
759 <p><a id="X7939F6F182FDA5F1" name="X7939F6F182FDA5F1"></a></p>
760
761 <h5>7.8-1 <span class="Heading">Function Profiling</span></h5>
762
763 <p>This section describes how to profiling at the function level. The idea is that</p>
764
765
766 <ul>
767 <li><p>first one switches on profiling for those <strong class="pkg">GAP</strong> functions the performance of which one wants to check,</p>
768
769 </li>
770 <li><p>then one runs some <strong class="pkg">GAP</strong> computations,</p>
771
772 </li>
773 <li><p>then one looks at the profile information collected during these computations,</p>
774
775 </li>
776 <li><p>then one runs more computations (perhaps clearing all profile information before, see <code class="func">ClearProfile</code> (<a href="chap7.html#X7DAF9AB9793AE203"><span class="RefLink">7.8-10</span></a>)),</p>
777
778 </li>
779 <li><p>and finally one switches off profiling.</p>
780
781 </li>
782 </ul>
783 <p>For switching on and off profiling, <strong class="pkg">GAP</strong> supports entering a list of functions (see <code class="func">ProfileFunctions</code> (<a href="chap7.html#X81E8A8627C34FD3B"><span class="RefLink">7.8-5</span></a>), <code class="func">UnprofileFunctions</code> (<a href="chap7.html#X79D394EC7BE8D008"><span class="RefLink">7.8-6</span></a>)) or a list of operations whose methods shall be (un)profiled (<code class="func">ProfileMethods</code> (<a href="chap7.html#X787AC3BE7F991344"><span class="RefLink">7.8-7</span></a>), <code class="func">UnprofileMethods</code> (<a href="chap7.html#X87A05F977F033693"><span class="RefLink">7.8-8</span></a>)), and <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>) can be used to show profile information about functions in a given list.</p>
784
785 <p>Besides these functions, <code class="func">ProfileGlobalFunctions</code> (<a href="chap7.html#X79D6CB927BBEB940"><span class="RefLink">7.8-2</span></a>), <code class="func">ProfileOperations</code> (<a href="chap7.html#X7C893F68841B990B"><span class="RefLink">7.8-3</span></a>), and <code class="func">ProfileOperationsAndMethods</code> (<a href="chap7.html#X79D41E977DCA2BEE"><span class="RefLink">7.8-4</span></a>) can be used for switching on or off profiling for <em>all</em> global functions, operations, and operations together with all their methods, respectively, and for showing profile information about these functions.</p>
786
787 <p>Note that <strong class="pkg">GAP</strong> will perform more slowly when profiling than when not.</p>
788
789 <p><a id="X79D6CB927BBEB940" name="X79D6CB927BBEB940"></a></p>
790
791 <h5>7.8-2 ProfileGlobalFunctions</h5>
792
793 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileGlobalFunctions</code>( [<var class="Arg">bool</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
794 <p>Called with argument <code class="keyw">true</code>, <code class="func">ProfileGlobalFunctions</code> starts profiling of all functions that have been declared via <code class="func">DeclareGlobalFunction</code> (<a href="chap79.html#X834A8CC587A609BE"><span class="RefLink">79.10-5</span></a>). Old profile information for all these functions is cleared. A function call with the argument <code class="keyw">false</code> stops profiling of all these functions. Recorded information is still kept, so you can display it even after turning the profiling off.</p>
795
796 <p>When <code class="func">ProfileGlobalFunctions</code> is called without argument, profile information for all global functions is displayed, see <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>).</p>
797
798 <p><a id="X7C893F68841B990B" name="X7C893F68841B990B"></a></p>
799
800 <h5>7.8-3 ProfileOperations</h5>
801
802 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileOperations</code>( [<var class="Arg">bool</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
803 <p>Called with argument <code class="keyw">true</code>, <code class="func">ProfileOperations</code> starts profiling of all operations. Old profile information for all operations is cleared. A function call with the argument <code class="keyw">false</code> stops profiling of all operations. Recorded information is still kept, so you can display it even after turning the profiling off.</p>
804
805 <p>When <code class="func">ProfileOperations</code> is called without argument, profile information for all operations is displayed (see <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>)).</p>
806
807 <p><a id="X79D41E977DCA2BEE" name="X79D41E977DCA2BEE"></a></p>
808
809 <h5>7.8-4 ProfileOperationsAndMethods</h5>
810
811 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileOperationsAndMethods</code>( [<var class="Arg">bool</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
812 <p>Called with argument <code class="keyw">true</code>, <code class="func">ProfileOperationsAndMethods</code> starts profiling of all operations and their methods. Old profile information for these functions is cleared. A function call with the argument <code class="keyw">false</code> stops profiling of all operations and their methods. Recorded information is still kept, so you can display it even after turning the profiling off.</p>
813
814 <p>When <code class="func">ProfileOperationsAndMethods</code> is called without argument, profile information for all operations and their methods is displayed, see <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>).</p>
815
816 <p><a id="X81E8A8627C34FD3B" name="X81E8A8627C34FD3B"></a></p>
817
818 <h5>7.8-5 ProfileFunctions</h5>
819
820 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileFunctions</code>( <var class="Arg">funcs</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
821 <p>starts profiling for all function in the list <var class="Arg">funcs</var>. You can use <code class="func">ProfileGlobalFunctions</code> (<a href="chap7.html#X79D6CB927BBEB940"><span class="RefLink">7.8-2</span></a>) to turn profiling on for all globally declared functions simultaneously.</p>
822
823 <p><a id="X79D394EC7BE8D008" name="X79D394EC7BE8D008"></a></p>
824
825 <h5>7.8-6 UnprofileFunctions</h5>
826
827 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnprofileFunctions</code>( <var class="Arg">funcs</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
828 <p>stops profiling for all function in the list <var class="Arg">funcs</var>. Recorded information is still kept, so you can display it even after turning the profiling off.</p>
829
830 <p><a id="X787AC3BE7F991344" name="X787AC3BE7F991344"></a></p>
831
832 <h5>7.8-7 ProfileMethods</h5>
833
834 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileMethods</code>( <var class="Arg">ops</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
835 <p>starts profiling of the methods for all operations in the list <var class="Arg">ops</var>.</p>
836
837 <p><a id="X87A05F977F033693" name="X87A05F977F033693"></a></p>
838
839 <h5>7.8-8 UnprofileMethods</h5>
840
841 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnprofileMethods</code>( <var class="Arg">ops</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
842 <p>stops profiling of the methods for all operations in the list <var class="Arg">ops</var>. Recorded information is still kept, so you can display it even after turning the profiling off.</p>
843
844 <p><a id="X80FEA6A08775A48E" name="X80FEA6A08775A48E"></a></p>
845
846 <h5>7.8-9 DisplayProfile</h5>
847
848 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DisplayProfile</code>( [<var class="Arg">functions</var>][,] [<var class="Arg">mincount</var>, <var class="Arg">mintime</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
849 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GAPInfo.ProfileThreshold</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
850 <p>Called without arguments, <code class="func">DisplayProfile</code> displays the profile information for profiled operations, methods and functions. If an argument <var class="Arg">functions</var> is given, only profile information for the functions in the list <var class="Arg">functions</var> is shown. If two integer values <var class="Arg">mincount</var>, <var class="Arg">mintime</var> are given as arguments then the output is restricted to those functions that were called at least <var class="Arg">mincount</var> times or for which the total time spent (see below) was at least <var class="Arg">mintime</var> milliseconds. The defaults for <var class="Arg">mincount</var> and <var class="Arg">mintime</var> are the entries of the list stored in the global variable <code class="func">GAPInfo.ProfileThreshold</code>.</p>
851
852 <p>The default value of <code class="func">GAPInfo.ProfileThreshold</code> is <code class="code">[ 10000, 30 ]</code>.</p>
853
854 <p>Profile information is displayed in a list of lines for all functions (including operations and methods) which are profiled. For each function, <q>count</q> gives the number of times the function has been called. <q>self/ms</q> gives the time (in milliseconds) spent in the function itself, <q>chld/ms</q> the time (in milliseconds) spent in profiled functions called from within this function, <q>stor/kb</q> the amount of storage (in kilobytes) allocated by the function itself, <q>chld/kb</q> the amount of storage (in kilobytes) allocated by profiled functions called from within this function, and <q>package</q> the name of the <strong class="pkg">GAP</strong> package to which the function belongs; the entry <q>GAP</q> in this column means that the function belongs to the <strong class="pkg">GAP</strong> library, the entry <q>(oprt.)</q> means that the function is an operation (which may belong to several packages), and an empty entry means that <code class="func">FilenameFunc</code> (<a href="chap5.html#X80E108C57F90FAA3"><span class="RefLink">5.1-4</span></a>) cannot determine in which file the function is defined.</p>
855
856 <p>The list is sorted according to the total time spent in the functions, that is the sum of the values in the columns <q>self/ms</q> and <q>chld/ms</q>.</p>
857
858 <p>At the end of the list, two lines are printed that show the total time used and the total memory allocated by the profiled functions not shown in the list (label <code class="code">OTHER</code>) and by all profiled functions (label <code class="code">TOTAL</code>), respectively.</p>
859
860 <p>An interactive variant of <code class="func">DisplayProfile</code> is the function <code class="func">BrowseProfile</code> (<a href="../../pkg/browse/doc/chap6.html#X7B42091982DE7AE7"><span class="RefLink">Browse: BrowseProfile</span></a>) that is provided by the <strong class="pkg">GAP</strong> package <strong class="pkg">Browse</strong>.</p>
861
862 <p><a id="X7DAF9AB9793AE203" name="X7DAF9AB9793AE203"></a></p>
863
864 <h5>7.8-10 ClearProfile</h5>
865
866 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ClearProfile</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
867 <p>clears all stored profile information.</p>
868
869 <p><a id="X7C5CE32579891120" name="X7C5CE32579891120"></a></p>
870
871 <h5>7.8-11 <span class="Heading">An Example of Function Profiling</span></h5>
872
873 <p>Let us suppose we want to get information about the computation of the conjugacy classes of a certain permutation group. For that, first we create the group, then we start profiling for all global functions and for all operations and their methods, then we compute the conjugacy classes, and then we stop profiling.</p>
874
875
876 <div class="example"><pre>
877 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">g:= PrimitiveGroup( 24, 1 );;</span>
878 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileGlobalFunctions( true );</span>
879 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileOperationsAndMethods( true );</span>
880 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ConjugacyClasses( g );;</span>
881 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileGlobalFunctions( false );</span>
882 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileOperationsAndMethods( false );</span>
883 </pre></div>
884
885 <p>Now the profile information is available. We can list the information for all profiled functions with <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>).</p>
886
887
888 <div class="example"><pre>
889 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DisplayProfile();</span>
890 count self/ms chld/ms stor/kb chld/kb package function
891 17647 0 0 275 0 GAP BasePoint
892 10230 0 0 226 0 (oprt.) ShallowCopy
893 10139 0 0 0 0 PositionSortedOp: for*
894 10001 0 0 688 0 UniteSet: for two int*
895 10001 8 0 28 688 (oprt.) UniteSet
896 14751 12 0 0 0 =: for two families: *
897 10830 8 4 182 276 GAP Concatenation
898 2700 20 12 313 55 GAP AddRefinement
899 2444 28 4 3924 317 GAP ConjugateStabChain
900 4368 0 32 7 714 (oprt.) Size
901 2174 32 4 1030 116 GAP List
902 585 4 32 45 742 GAP RRefine
903 1532 32 8 194 56 GAP AddGeneratorsExtendSc*
904 1221 8 32 349 420 GAP Partition
905 185309 28 12 0 0 (oprt.) Length
906 336 4 40 95 817 GAP ExtendSeriesPermGroup
907 4 28 20 488 454 (oprt.) Sortex
908 2798 0 52 54 944 GAP StabChainForcePoint
909 560 4 48 83 628 GAP StabChainSwap
910 432 16 40 259 461 GAP SubmagmaWithInversesNC
911 185553 48 8 915 94 (oprt.) Add
912 26 0 64 0 2023 (oprt.) CentralizerOp
913 26 0 64 0 2023 GAP CentralizerOp: perm g*
914 26 0 64 0 2023 GAP Centralizer: try to e*
915 152 4 64 0 2024 (oprt.) Centralizer
916 1605 0 68 0 2032 (oprt.) StabilizerOfExternalS*
917 26 0 68 0 2024 GAP Meth(StabilizerOfExte*
918 382 0 96 69 1922 GAP TryPcgsPermGroup
919 5130 4 96 309 3165 GAP ForAll
920 7980 24 116 330 6434 GAP ChangeStabChain
921 12076 12 136 351 6478 GAP ProcessFixpoint
922 192 0 148 4 3029 GAP StabChainMutable: cal*
923 2208 4 148 3 3083 (oprt.) StabChainMutable
924 217 0 160 0 3177 (oprt.) StabChainOp
925 217 12 148 60 3117 GAP StabChainOp: group an*
926 216 36 464 334 12546 GAP PartitionBacktrack
927 1479 12 668 566 18474 GAP RepOpElmTuplesPermGro*
928 1453 12 684 56 18460 GAP in: perm class rep
929 126 0 728 13 19233 GAP ConjugacyClassesTry
930 1 0 736 0 19671 GAP ConjugacyClassesByRan*
931 2 0 736 2 19678 (oprt.) ConjugacyClasses
932 1 0 736 0 19675 GAP ConjugacyClasses: per*
933 13400 1164 0 0 0 (oprt.) Position
934 484 12052 OTHER
935 2048 23319 TOTAL
936 </pre></div>
937
938 <p>We can restrict the list to global functions with <code class="func">ProfileGlobalFunctions</code> (<a href="chap7.html#X79D6CB927BBEB940"><span class="RefLink">7.8-2</span></a>).</p>
939
940
941 <div class="example"><pre>
942 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileGlobalFunctions();</span>
943 count self/ms chld/ms stor/kb chld/kb package function
944 17647 0 0 275 0 GAP BasePoint
945 10830 8 4 182 276 GAP Concatenation
946 2700 20 12 313 55 GAP AddRefinement
947 2444 28 4 3924 317 GAP ConjugateStabChain
948 2174 32 4 1030 116 GAP List
949 585 4 32 45 742 GAP RRefine
950 1532 32 8 194 56 GAP AddGeneratorsExtendSc*
951 1221 8 32 349 420 GAP Partition
952 336 4 40 95 817 GAP ExtendSeriesPermGroup
953 2798 0 52 54 944 GAP StabChainForcePoint
954 560 4 48 83 628 GAP StabChainSwap
955 432 16 40 259 461 GAP SubmagmaWithInversesNC
956 382 0 96 69 1922 GAP TryPcgsPermGroup
957 5130 4 96 309 3165 GAP ForAll
958 7980 24 116 330 6434 GAP ChangeStabChain
959 12076 12 136 351 6478 GAP ProcessFixpoint
960 216 36 464 334 12546 GAP PartitionBacktrack
961 1479 12 668 566 18474 GAP RepOpElmTuplesPermGro*
962 126 0 728 13 19233 GAP ConjugacyClassesTry
963 1 0 736 0 19671 GAP ConjugacyClassesByRan*
964 1804 14536 OTHER
965 2048 23319 TOTAL
966 </pre></div>
967
968 <p>We can restrict the list to operations with <code class="func">ProfileOperations</code> (<a href="chap7.html#X7C893F68841B990B"><span class="RefLink">7.8-3</span></a>).</p>
969
970
971 <div class="example"><pre>
972 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileOperations();</span>
973 count self/ms chld/ms stor/kb chld/kb package function
974 10230 0 0 226 0 (oprt.) ShallowCopy
975 10001 8 0 28 688 (oprt.) UniteSet
976 4368 0 32 7 714 (oprt.) Size
977 185309 28 12 0 0 (oprt.) Length
978 4 28 20 488 454 (oprt.) Sortex
979 185553 48 8 915 94 (oprt.) Add
980 26 0 64 0 2023 (oprt.) CentralizerOp
981 152 4 64 0 2024 (oprt.) Centralizer
982 1605 0 68 0 2032 (oprt.) StabilizerOfExternalS*
983 2208 4 148 3 3083 (oprt.) StabChainMutable
984 217 0 160 0 3177 (oprt.) StabChainOp
985 2 0 736 2 19678 (oprt.) ConjugacyClasses
986 13400 1164 0 0 0 (oprt.) Position
987 764 21646 OTHER
988 2048 23319 TOTAL
989 </pre></div>
990
991 <p>We can restrict the list to operations and their methods with <code class="func">ProfileOperationsAndMethods</code> (<a href="chap7.html#X79D41E977DCA2BEE"><span class="RefLink">7.8-4</span></a>).</p>
992
993
994 <div class="example"><pre>
995 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileOperationsAndMethods();</span>
996 count self/ms chld/ms stor/kb chld/kb package function
997 10230 0 0 226 0 (oprt.) ShallowCopy
998 10139 0 0 0 0 PositionSortedOp: for*
999 10001 0 0 688 0 UniteSet: for two int*
1000 10001 8 0 28 688 (oprt.) UniteSet
1001 14751 12 0 0 0 =: for two families: *
1002 4368 0 32 7 714 (oprt.) Size
1003 185309 28 12 0 0 (oprt.) Length
1004 4 28 20 488 454 (oprt.) Sortex
1005 185553 48 8 915 94 (oprt.) Add
1006 26 0 64 0 2023 (oprt.) CentralizerOp
1007 26 0 64 0 2023 GAP CentralizerOp: perm g*
1008 26 0 64 0 2023 GAP Centralizer: try to e*
1009 152 4 64 0 2024 (oprt.) Centralizer
1010 1605 0 68 0 2032 (oprt.) StabilizerOfExternalS*
1011 26 0 68 0 2024 GAP Meth(StabilizerOfExte*
1012 192 0 148 4 3029 GAP StabChainMutable: cal*
1013 2208 4 148 3 3083 (oprt.) StabChainMutable
1014 217 0 160 0 3177 (oprt.) StabChainOp
1015 217 12 148 60 3117 GAP StabChainOp: group an*
1016 1453 12 684 56 18460 GAP in: perm class rep
1017 2 0 736 2 19678 (oprt.) ConjugacyClasses
1018 1 0 736 0 19675 GAP ConjugacyClasses: per*
1019 13400 1164 0 0 0 (oprt.) Position
1020 728 20834 OTHER
1021 2048 23319 TOTAL
1022 </pre></div>
1023
1024 <p>Finally, we can restrict the list to explicitly given functions with <code class="func">DisplayProfile</code> (<a href="chap7.html#X80FEA6A08775A48E"><span class="RefLink">7.8-9</span></a>), by entering the list of functions as an argument.</p>
1025
1026
1027 <div class="example"><pre>
1028 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DisplayProfile( [ StabChainOp, Centralizer ] );</span>
1029 count self/ms chld/ms stor/kb chld/kb package function
1030 152 4 64 0 2024 (oprt.) Centralizer
1031 217 0 160 0 3177 (oprt.) StabChainOp
1032 2044 23319 OTHER
1033 2048 23319 TOTAL
1034 </pre></div>
1035
1036 <p><a id="X812F9CE0817110EA" name="X812F9CE0817110EA"></a></p>
1037
1038 <h5>7.8-12 <span class="Heading">Line By Line Profiling</span></h5>
1039
1040 <p>Line By Line profiling tracks which lines have been executed in a piece of GAP code. Built into GAP are the methods necessary to generate profiles, the resulting profiles can be displayed with the 'profiling' package.</p>
1041
1042 <p><a id="X7E9C65B17B8EF993" name="X7E9C65B17B8EF993"></a></p>
1043
1044 <h5>7.8-13 <span class="Heading">Line by Line profiling example</span></h5>
1045
1046 <p>There are two kinds of profiles GAP can build:</p>
1047
1048
1049 <ul>
1050 <li><p>Coverage : This records which lines of code are executed</p>
1051
1052 </li>
1053 <li><p>Timing : This records how much time is spend executing each line of code</p>
1054
1055 </li>
1056 </ul>
1057 <p>A timing profile provides more information, but will take longer to generate and parse. A timing profile is generated using the functions <code class="func">ProfileLineByLine</code> (<a href="chap7.html#X86557887796F66FA"><span class="RefLink">7.8-14</span></a>) and <code class="func">UnprofileLineByLine</code> (<a href="chap7.html#X7C5DED9C7CC77504"><span class="RefLink">7.8-16</span></a>), as follows:</p>
1058
1059
1060 <div class="example"><pre>
1061 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ProfileLineByLine("output.gz");</span>
1062 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Size(AlternatingGroup(10)); ; # Execute some GAP code you want to profile</span>
1063 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">UnprofileLineByLine();</span>
1064 </pre></div>
1065
1066 <p>For code coverage, use instead the functions <code class="func">CoverageLineByLine</code> (<a href="chap7.html#X87CC48807DB4C008"><span class="RefLink">7.8-15</span></a>) and <code class="func">UncoverageLineByLine</code> (<a href="chap7.html#X7B705B2D8670A9C5"><span class="RefLink">7.8-17</span></a>). The profiler will only record lines which are read and executed while the profiler is running. If you want to perform code coverage or profile GAP's library, then you can use the GAP command line option '--cover filename.gz', which executes <code class="func">CoverageLineByLine</code> (<a href="chap7.html#X87CC48807DB4C008"><span class="RefLink">7.8-15</span></a>) before GAP starts. Similarly the option '--prof filename.gz' executes <code class="func">ProfileLineByLine</code> (<a href="chap7.html#X86557887796F66FA"><span class="RefLink">7.8-14</span></a>) before GAP starts. The profiler is designed for high performance, because of this, there are some limitations which users should be aware of:</p>
1067
1068
1069 <ul>
1070 <li><p>By default the profiler records the wall-clock time which has passed, rather than the CPU time taken (because it is lower overhead), so any time taken writing commands will be charged to the last GAP statement which was executed. Therefore it is better to write a function which starts profiling, executes your code, and then stops profiling.</p>
1071
1072 </li>
1073 <li><p>If you end the filename with ".gz", the resulting file will automatically be compressed. This is highly recommended!</p>
1074
1075 </li>
1076 <li><p>The profiler can only track GAP code which occurs in a function -- this is most obvious when looking at code coverage examples, which will appear to miss lines of code in files not in a function.</p>
1077
1078 </li>
1079 <li><p>If the current GAP is forked, using the <code class="code">IO_fork</code> function in the <strong class="pkg">IO</strong> package, a new profile output file will be created for the new child process, with the process ID of the child attached to the end of the filename.</p>
1080
1081 </li>
1082 </ul>
1083 <p>Profiles are transformed into a human-readable form with 'profiling' package, for example with the 'OutputAnnotatedCodeCoverageFiles' function.</p>
1084
1085 <p><a id="X86557887796F66FA" name="X86557887796F66FA"></a></p>
1086
1087 <h5>7.8-14 ProfileLineByLine</h5>
1088
1089 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ProfileLineByLine</code>( <var class="Arg">filename</var>[, <var class="Arg">options</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1090 <p><code class="func">ProfileLineByLine</code> begins GAP recording profiling data to the file <var class="Arg">filename</var>. This file will get *very* large very quickly. This file is compressed using gzip to reduce its size. <var class="Arg">options</var> is an optional dictionary, which sets various configuration options. These are</p>
1091
1092
1093 <dl>
1094 <dt><strong class="Mark">coverage</strong></dt>
1095 <dd><p>Boolean (defaults to false). If this is enabled, only information about which lines are read and executed is stored. Enabling this is the same as calling <code class="func">CoverageLineByLine</code> (<a href="chap7.html#X87CC48807DB4C008"><span class="RefLink">7.8-15</span></a>). Using this ignores all other options.</p>
1096
1097 </dd>
1098 <dt><strong class="Mark">wallTime</strong></dt>
1099 <dd><p>Boolean (defaults to true). Sets if time should be measured using wall-clock time (true) or CPU time (false). (measuring CPU-time has a higher overhead).</p>
1100
1101 </dd>
1102 <dt><strong class="Mark">recordMem</strong></dt>
1103 <dd><p>Boolean (defaults to false). Instead of recording the CPU time taken by statements, record the total size of all new objects created by each line.</p>
1104
1105 </dd>
1106 <dt><strong class="Mark">resolution</strong></dt>
1107 <dd><p>Integer (defaults to 0). By default profiling will record a trace of all executed code. When <var class="Arg">resolution</var> non-zero, GAP instead samples which piece of code is being executed every <var class="Arg">resolution</var> nanoseconds. Increasing this improves performance and produces smaller traces, at the cost of accuracy. GAP will still accurately record which statements are executed at least once.</p>
1108
1109 </dd>
1110 </dl>
1111 <p><a id="X87CC48807DB4C008" name="X87CC48807DB4C008"></a></p>
1112
1113 <h5>7.8-15 CoverageLineByLine</h5>
1114
1115 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CoverageLineByLine</code>( <var class="Arg">filename</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1116 <p><code class="func">CoverageLineByLine</code> begins GAP recording code coverage to the file <var class="Arg">filename</var>. This is equivalent to calling <code class="func">ProfileLineByLine</code> (<a href="chap7.html#X86557887796F66FA"><span class="RefLink">7.8-14</span></a>) with coverage=true.</p>
1117
1118 <p><a id="X7C5DED9C7CC77504" name="X7C5DED9C7CC77504"></a></p>
1119
1120 <h5>7.8-16 UnprofileLineByLine</h5>
1121
1122 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UnprofileLineByLine</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1123 <p>Stops profiling which was previously started with <code class="func">ProfileLineByLine</code> (<a href="chap7.html#X86557887796F66FA"><span class="RefLink">7.8-14</span></a>) or <code class="func">CoverageLineByLine</code> (<a href="chap7.html#X87CC48807DB4C008"><span class="RefLink">7.8-15</span></a>).</p>
1124
1125 <p><a id="X7B705B2D8670A9C5" name="X7B705B2D8670A9C5"></a></p>
1126
1127 <h5>7.8-17 UncoverageLineByLine</h5>
1128
1129 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; UncoverageLineByLine</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1130 <p>Stops profiling which was previously started with <code class="func">ProfileLineByLine</code> (<a href="chap7.html#X86557887796F66FA"><span class="RefLink">7.8-14</span></a>) or <code class="func">CoverageLineByLine</code> (<a href="chap7.html#X87CC48807DB4C008"><span class="RefLink">7.8-15</span></a>).</p>
1131
1132 <p><a id="X7823C83D79B36D3B" name="X7823C83D79B36D3B"></a></p>
1133
1134 <h5>7.8-18 IsLineByLineProfileActive</h5>
1135
1136 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsLineByLineProfileActive</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1137 <p><code class="func">IsLineByLineProfileActive</code> returns if line-by-line profiling is currently activated.</p>
1138
1139 <p><a id="X83D8A42B7BB92F5B" name="X83D8A42B7BB92F5B"></a></p>
1140
1141 <h5>7.8-19 DisplayCacheStats</h5>
1142
1143 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DisplayCacheStats</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1144 <p>displays statistics about the different caches used by the method selection.</p>
1145
1146 <p><a id="X79C58704838232CC" name="X79C58704838232CC"></a></p>
1147
1148 <h5>7.8-20 ClearCacheStats</h5>
1149
1150 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ClearCacheStats</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1151 <p>clears all statistics about the different caches used by the method selection.</p>
1152
1153 <p><a id="X7EE874867C0BEEDD" name="X7EE874867C0BEEDD"></a></p>
1154
1155 <h4>7.9 <span class="Heading">Information about the version used</span></h4>
1156
1157 <p>The global variable <code class="code">GAPInfo.Version</code> (see <code class="func">GAPInfo</code> (<a href="chap3.html#X8354754E7935F935"><span class="RefLink">3.5-1</span></a>)) contains the version number of the version of <strong class="pkg">GAP</strong>. Its value can be checked other version number using <code class="func">CompareVersionNumbers</code> (<a href="chap76.html#X787DFEB383545A49"><span class="RefLink">76.3-9</span></a>).</p>
1158
1159 <p>To produce sample citations for the used version of <strong class="pkg">GAP</strong> or for a package available in this <strong class="pkg">GAP</strong> installation, use <code class="func">Cite</code> (<a href="chap76.html#X79637D9A7B1AD7F7"><span class="RefLink">76.3-19</span></a>).</p>
1160
1161 <p>If you wish to report a problem to <strong class="pkg">GAP</strong> Support or <strong class="pkg">GAP</strong> Forum, it may be useful to not only report the version used, but also to include the <strong class="pkg">GAP</strong> banner displays the information about the architecture for which the <strong class="pkg">GAP</strong> binary is built, used libraries and loaded packages.</p>
1162
1163 <p><a id="X801051CC86594630" name="X801051CC86594630"></a></p>
1164
1165 <h4>7.10 <span class="Heading">Test Files</span></h4>
1166
1167 <p>Test files are used to check that <strong class="pkg">GAP</strong> produces correct results in certain computations. A selection of test files for the library can be found in the <code class="file">tst</code> directory of the <strong class="pkg">GAP</strong> distribution.</p>
1168
1169 <p><a id="X8213757B7ACC76E6" name="X8213757B7ACC76E6"></a></p>
1170
1171 <h5>7.10-1 <span class="Heading">Starting and stopping test</span></h5>
1172
1173 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; START_TEST</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1174 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; STOP_TEST</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1175 <p><code class="func">START_TEST</code> and <code class="func">STOP_TEST</code> may be optionally used in files that are read via <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>). If used, <code class="func">START_TEST</code> reinitializes</p>
1176
1177
1178 <ul>
1179 <li><p>the caches (see <code class="func">FlushCaches</code> (<a href="chap79.html#X87A4316C818B3DE3"><span class="RefLink">79.10-4</span></a>)),</p>
1180
1181 </li>
1182 <li><p>the global random number generators (see <code class="func">GlobalMersenneTwister</code> (<a href="chap14.html#X7AC96008820FAF1F"><span class="RefLink">14.7-4</span></a>)), and</p>
1183
1184 </li>
1185 <li><p>the global options stack (see Chapter <a href="chap8.html#X7FD84061873F72A2"><span class="RefLink">8</span></a>),</p>
1186
1187 </li>
1188 </ul>
1189 <p>in order to be independent of the reading order of several test files.</p>
1190
1191 <p>Furthermore, the assertion level (see <code class="func">Assert</code> (<a href="chap7.html#X830E443284780FB9"><span class="RefLink">7.5-3</span></a>)) is set to <span class="SimpleMath">2</span> (if it was lower before) by <code class="func">START_TEST</code> and set back to the previous value in the subsequent <code class="func">STOP_TEST</code> call.</p>
1192
1193 <p>Also <code class="func">STOP_TEST</code> reinitializes the global options stack, otherwise it could happen that options which got set during the tests are not reset after the tests.</p>
1194
1195 <p>To use this feature, a test file should be started with a line</p>
1196
1197
1198 <div class="example"><pre>
1199 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">START_TEST( "arbitrary identifier string" );</span>
1200 </pre></div>
1201
1202 <p>(Note that the <code class="code">gap&gt; </code> prompt is part of the line!)</p>
1203
1204 <p>and should be finished with a line</p>
1205
1206
1207 <div class="example"><pre>
1208 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">STOP_TEST( "same identifier string as for START_TEST" );</span>
1209 </pre></div>
1210
1211 <p>If you want to run a quick test of your <strong class="pkg">GAP</strong> installation (though this is not required), you can read in a test script that exercises some <strong class="pkg">GAP</strong>'s capabilities.</p>
1212
1213
1214 <div class="example"><pre>
1215 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Read( Filename( DirectoriesLibrary( "tst" ), "testinstall.g" ) );</span>
1216 </pre></div>
1217
1218
1219 <div class="example"><pre>
1220 test file time(msec)
1221 -------------------------------------------
1222 testing: ................/gap4r5/tst/zlattice.tst
1223 zlattice.tst 0
1224 testing: ................/gap4r5/tst/gaussian.tst
1225 gaussian.tst 10
1226 [ further lines deleted ]
1227 </pre></div>
1228
1229 <p>If you want to run a more advanced check (this is not required and make take up to an hour), you can read <code class="file">teststandard.g</code> which is an extended test script performing all tests from the <code class="file">tst</code> directory.</p>
1230
1231
1232 <div class="example"><pre>
1233 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Read( Filename( DirectoriesLibrary( "tst" ), "teststandard.g" ) );</span>
1234 </pre></div>
1235
1236 <p><a id="X87712F9D8732193C" name="X87712F9D8732193C"></a></p>
1237
1238 <h5>7.10-2 Test</h5>
1239
1240 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Test</code>( <var class="Arg">fname</var>[, <var class="Arg">optrec</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1241 <p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
1242
1243 <p>The argument <var class="Arg">fname</var> must be the name of a file or an open input stream. The content of this file or stream should contain <strong class="pkg">GAP</strong> input and output. The function <code class="func">Test</code> runs the input lines, compares the actual output with the output stored in <var class="Arg">fname</var> and reports differences. With an optional record as argument <var class="Arg">optrec</var> details of this process can be adjusted. Note that the <code class="code">rewriteToFile</code> option is especially useful for generating test files.</p>
1244
1245 <p>More precisely, the content of <var class="Arg">fname</var> must have the following format. <br /> Lines starting with <code class="code">"gap&gt; "</code> are considered as <strong class="pkg">GAP</strong> input, they can be followed by lines starting with <code class="code">"&gt; "</code> if the input is continued over several lines. <br /> To allow for comments in <var class="Arg">fname</var> the following lines are ignored by default: lines at the beginning of <var class="Arg">fname</var> that start with <code class="code">"#"</code> or are empty, and one empty line together with one or more lines starting with <code class="code">"#"</code>.<br /> All other lines are considered as <strong class="pkg">GAP</strong> output from the preceding <strong class="pkg">GAP</strong> input.</p>
1246
1247 <p>Lines which begin "#@" define special configuration options for tests. The <code class="code">#@local</code> and <code class="code">#@exec</code> options can only be used before any <strong class="pkg">GAP</strong> input, and the other commands can only be used between individual tests (just before a line starting <code class="code">gap&gt;</code>, or at end of the file). Currently defined options are:</p>
1248
1249
1250 <dl>
1251 <dt><strong class="Mark">#@local identifierlist</strong></dt>
1252 <dd><p>Run all the tests in the input as if it is in a function with local variable list <code class="code">identifierlist</code>, which is a comma-separated list of identifiers. Multiple #@local lines may be used. These lines should <em>not</em> end with a comma or semicolon. If this option is used then an error will occur unless <em>all</em> the variables used are included in the local list.</p>
1253
1254 <p>As an example, the <strong class="pkg">Utils</strong> package has a test file <code class="code">tst/iterator.tst</code> which starts with the lines:</p>
1255
1256
1257 <div class="example"><pre>
1258 #@local c3c3, cart, G, h, it1, it2, iter, iter0, iter4, iterL
1259 #@local L, n, pairs0, pairs4, pairsL, s3, s4
1260 </pre></div>
1261
1262 </dd>
1263 <dt><strong class="Mark">#@exec gapcode</strong></dt>
1264 <dd><p>Execute the code <code class="code">gapcode</code> before any test in the input is run. This allows defining global variables when using <code class="code">#@local</code>.</p>
1265
1266 </dd>
1267 <dt><strong class="Mark">#@if EXPR ... {#@elif EXPR ...} [#@else ...] #@fi</strong></dt>
1268 <dd><p>A <code class="code">#@if</code> allows to conditionally skip parts of the test input depending on the value of a boolean expression. The exact behavior is done as follows:</p>
1269
1270 <p>If the first <strong class="pkg">GAP</strong> expression <code class="code">EXPR</code> evaluates to <code class="keyw">true</code>, then the lines after the <code class="code">#@if</code> are used until either a <code class="code">#@elif</code>, <code class="code">#@else</code> or <code class="code">#@fi</code> is reached. If an <code class="code">#@elif</code> is present, then the lines after <code class="code">#@elif</code> are used if and only if its <code class="code">EXPR</code> evaluates to <code class="keyw">true</code> and all previous <code class="code">#@if</code> and <code class="code">#@elif</code> clauses had expressions evaluating to <code class="keyw">false</code>. In this case the lines after <code class="code">#@elif</code> are used until either a <code class="code">#@elif</code>, <code class="code">#@else</code> or <code class="code">#@fi</code> is reached. If an <code class="code">#@else</code> is present then the lines after the <code class="code">#@else</code> are used if and only if <code class="code">EXPR</code> evaluated to <code class="keyw">false</code> in all <code class="code">#@if</code> and <code class="code">#@elif</code> clauses. Finally, once <code class="code">#fi</code> is reached, evaluation continues normally.</p>
1271
1272 <p>Note that each <code class="code">EXPR</code> is evaluated after all <code class="code">#@exec</code> lines have been executed but before any tests are run. Thus, it cannot depend on test results or packages loaded in tests, but it can depend on packages loaded via <code class="code">#@exec</code>.</p>
1273
1274 <p>In addition <code class="code">#@if</code> clauses cannot be nested within each other.</p>
1275
1276 <p>As an example, the <strong class="pkg">GAP</strong> test suite contains the test file <code class="code">tst/testinstall/pperm.tst</code> which contains the lines:</p>
1277
1278
1279 <div class="example"><pre>
1280 #@if GAPInfo.BytesPerVariable = 8
1281 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HASH_FUNC_FOR_PPERM(f, 10 ^ 6) in [260581, 402746];</span>
1282 true
1283 #@else
1284 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HASH_FUNC_FOR_PPERM(f, 10 ^ 6);</span>
1285 953600
1286 #@fi
1287 </pre></div>
1288
1289 </dd>
1290 </dl>
1291 <p>By default the actual <strong class="pkg">GAP</strong> output is compared exactly with the stored output, and if these are different some information about the differences is printed.</p>
1292
1293 <p>If any differences are found then <code class="func">Test</code> returns <code class="keyw">false</code>, otherwise <code class="keyw">true</code>.</p>
1294
1295 <p>If the optional argument <var class="Arg">optrec</var> is given it must be a record. The following components of <var class="Arg">optrec</var> are recognized and can change the default behaviour of <code class="func">Test</code>:</p>
1296
1297
1298 <dl>
1299 <dt><strong class="Mark"><code class="code">ignoreComments</code></strong></dt>
1300 <dd><p>If set to <code class="keyw">false</code> then no lines in <var class="Arg">fname</var> are ignored as explained above (default is <code class="keyw">true</code>).</p>
1301
1302 </dd>
1303 <dt><strong class="Mark"><code class="code">width</code></strong></dt>
1304 <dd><p>The screen width used for the new output (default is <code class="code">80</code>).</p>
1305
1306 </dd>
1307 <dt><strong class="Mark"><code class="code">compareFunction</code></strong></dt>
1308 <dd><p>This must be a function that gets two strings as input, the newly generated and the stored output of some <strong class="pkg">GAP</strong> input. The function must return <code class="keyw">true</code> or <code class="keyw">false</code>, indicating if the strings should be considered equivalent or not. By default <code class="func">\=</code> (<a href="chap31.html#X7EF67D047F03CA6F"><span class="RefLink">31.11-1</span></a>) is used. <br /> Two strings are recognized as abbreviations in this component: <code class="code">"uptowhitespace"</code> checks if the two strings become equal after removing all white space. And <code class="code">"uptonl"</code> compares the string up to trailing newline characters.</p>
1309
1310 </dd>
1311 <dt><strong class="Mark"><code class="code">transformFunction</code></strong></dt>
1312 <dd><p>This must be a function that gets one string as input, either the newly generated or the stored output of some <strong class="pkg">GAP</strong> input. The function must return a new string which will be used to compare the actual and the expected output. By default <code class="func">IdFunc</code> (<a href="chap5.html#X810325697BDEF899"><span class="RefLink">5.4-6</span></a>) is used. <br /> Two strings are recognized as abbreviations in this component: <code class="code">"removewhitespace"</code> removes all white space. And <code class="code">"removenl"</code> removes all trailing newline characters.</p>
1313
1314 </dd>
1315 <dt><strong class="Mark"><code class="code">reportDiff</code></strong></dt>
1316 <dd><p>A function that gets six arguments and reports a difference in the output: the <strong class="pkg">GAP</strong> input, the expected <strong class="pkg">GAP</strong> output, the newly generated output, the name of tested file, the line number of the input, the time to run the input. (The default is demonstrated in the example below.)</p>
1317
1318 </dd>
1319 <dt><strong class="Mark"><code class="code">rewriteToFile</code></strong></dt>
1320 <dd><p>If this is bound to a string it is considered as a file name and that file is written with the same input and comment lines as <var class="Arg">fname</var> but the output substituted by the newly generated version; if it is bound to <code class="keyw">true</code>, then this is treated as if it was bound to <var class="Arg">fname</var> (default is <code class="keyw">false</code>). This is especially useful for generating test files because it ensures that the test files are formatted exactly as <code class="func">Test</code> expects them to be.</p>
1321
1322 </dd>
1323 <dt><strong class="Mark"><code class="code">writeTimings</code></strong></dt>
1324 <dd><p>If this is bound to a string it is considered as a file name, that file is written and contains timing information for each input in <var class="Arg">fname</var>.</p>
1325
1326 </dd>
1327 <dt><strong class="Mark"><code class="code">compareTimings</code></strong></dt>
1328 <dd><p>If this is bound to a string it is considered as name of a file to which timing information was stored via <code class="code">writeTimings</code> in a previous call. The new timings are compared to the stored ones. By default only commands which take more than a threshold of 100 milliseconds are considered, and only differences of more than 20% are considered significant. These defaults can be overwritten by assigning a list <code class="code">[timingfile, threshold, percentage]</code> to this component. (The default of <code class="code">compareTimings</code> is <code class="keyw">false</code>.)</p>
1329
1330 </dd>
1331 <dt><strong class="Mark"><code class="code">reportTimeDiff</code></strong></dt>
1332 <dd><p>This component can be used to overwrite the default function to display timing differences. It must be a function with 5 arguments: <strong class="pkg">GAP</strong> input, name of test file, line number, stored time, new time.</p>
1333
1334 </dd>
1335 <dt><strong class="Mark"><code class="code">ignoreSTOP_TEST</code></strong></dt>
1336 <dd><p>By default set to <code class="keyw">true</code>, in that case the output of <strong class="pkg">GAP</strong> input starting with <code class="code">"STOP_TEST"</code> is not checked.</p>
1337
1338 </dd>
1339 <dt><strong class="Mark"><code class="code">showProgress</code></strong></dt>
1340 <dd><p>If this is <code class="keyw">true</code> then <strong class="pkg">GAP</strong> prints position information and the input line before it is processed; if set to <code class="code">"some"</code>, then GAP shows the current line number of the test being processed; if set to <code class="keyw">false</code>, no progress updates are displayed (default is <code class="code">"some"</code> if GAP's output goes to a terminal, otherwise <code class="keyw">false</code>).</p>
1341
1342 </dd>
1343 <dt><strong class="Mark"><code class="code">subsWindowsLineBreaks</code></strong></dt>
1344 <dd><p>If this is <code class="keyw">true</code> then <strong class="pkg">GAP</strong> substitutes DOS/Windows style line breaks "\r\n" by UNIX style line breaks "\n" after reading the test file. (default is <code class="keyw">true</code>).</p>
1345
1346 </dd>
1347 <dt><strong class="Mark"><code class="code">returnNumFailures</code></strong></dt>
1348 <dd><p>If this is <code class="keyw">true</code> then <strong class="pkg">GAP</strong> returns the number of input lines of the test file which had differences in their output, instead of returning <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
1349
1350 </dd>
1351 </dl>
1352
1353 <div class="example"><pre>
1354 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">tnam := Filename(DirectoriesLibrary(), "../doc/ref/demo.tst");;</span>
1355 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">mask := function(str) return Concatenation("| ",</span>
1356 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> JoinStringsWithSeparator(SplitString(str, "\n", ""), "\n| "),</span>
1357 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> "\n"); end;;</span>
1358 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Print(mask(StringFile(tnam)));</span>
1359 | # this is a demo file for the 'Test' function
1360 | #
1361 | gap&gt; g := Group((1,2), (1,2,3));
1362 | Group([ (1,2), (1,2,3) ])
1363 |
1364 | # another comment following an empty line
1365 | # the following fails:
1366 | gap&gt; a := 13+29;
1367 | 41
1368 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ss := InputTextString(StringFile(tnam));;</span>
1369 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Test(ss);</span>
1370 ########&gt; Diff in test stream, line 8:
1371 # Input is:
1372 a := 13+29;
1373 # Expected output:
1374 41
1375 # But found:
1376 42
1377 ########
1378 false
1379 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RewindStream(ss);</span>
1380 true
1381 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dtmp := DirectoryTemporary();;</span>
1382 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ftmp := Filename(dtmp,"demo.tst");;</span>
1383 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Test(ss, rec(reportDiff := Ignore, rewriteToFile := ftmp));</span>
1384 false
1385 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Test(ftmp);</span>
1386 true
1387 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Print(mask(StringFile(ftmp)));</span>
1388 | # this is a demo file for the 'Test' function
1389 | #
1390 | gap&gt; g := Group((1,2), (1,2,3));
1391 | Group([ (1,2), (1,2,3) ])
1392 |
1393 | # another comment following an empty line
1394 | # the following fails:
1395 | gap&gt; a := 13+29;
1396 | 42
1397 </pre></div>
1398
1399 <p><a id="X87AF67528799481F" name="X87AF67528799481F"></a></p>
1400
1401 <h5>7.10-3 TestDirectory</h5>
1402
1403 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TestDirectory</code>( <var class="Arg">inlist</var>[, <var class="Arg">optrec</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1404 <p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
1405
1406 <p>The argument <var class="Arg">inlist</var> must be either a single filename or directory name, or a list of filenames and directories. The function <code class="func">TestDirectory</code> will create a list of files to be tested by taking any files in <var class="Arg">inlist</var>, and recursively searching any directories in <var class="Arg">inlist</var> for files ending in <code class="code">.tst</code>. Each of these files is then run through <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>), and the results printed, and <code class="keyw">true</code> returned if all tests passed.</p>
1407
1408 <p>If the optional argument <var class="Arg">optrec</var> is given it must be a record. Note that the <code class="code">rewriteToFile</code> option is especially useful for generating test files. The following components of <var class="Arg">optrec</var> are recognized and can change the default behaviour of <code class="func">TestDirectory</code>:</p>
1409
1410
1411 <dl>
1412 <dt><strong class="Mark"><code class="code">testOptions</code></strong></dt>
1413 <dd><p>A record which will be passed on as the second argument of <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>) if present.</p>
1414
1415 </dd>
1416 <dt><strong class="Mark"><code class="code">earlyStop</code></strong></dt>
1417 <dd><p>If <code class="keyw">true</code>, stop as soon as any <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>) fails (defaults to <code class="keyw">false</code>).</p>
1418
1419 </dd>
1420 <dt><strong class="Mark"><code class="code">showProgress</code></strong></dt>
1421 <dd><p>Print information about how tests are progressing (defaults to <code class="code">"some"</code> if GAP's output goes to a terminal, otherwise <code class="keyw">false</code>).</p>
1422
1423 </dd>
1424 <dt><strong class="Mark"><code class="code">suppressStatusMessage</code></strong></dt>
1425 <dd><p>suppress displaying status messages <code class="code">#I Errors detected while testing</code> and <code class="code">#I No errors detected while testing</code> after the test (defaults to <code class="keyw">false</code>).</p>
1426
1427 </dd>
1428 <dt><strong class="Mark"><code class="code">rewriteToFile</code></strong></dt>
1429 <dd><p>If <code class="keyw">true</code>, then rewrite each test file to disc, with the output substituted by the results of running the test (defaults to <code class="keyw">false</code>). This is especially useful for generating test files because it ensures that the test files are formatted exactly as <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>) expects them to be.</p>
1430
1431 </dd>
1432 <dt><strong class="Mark"><code class="code">exclude</code></strong></dt>
1433 <dd><p>A list of file and directory names which will be excluded from testing (defaults to <code class="keyw">[]</code>).</p>
1434
1435 </dd>
1436 <dt><strong class="Mark"><code class="code">exitGAP</code></strong></dt>
1437 <dd><p>Rather than returning <code class="keyw">true</code> or <code class="keyw">false</code>, exit GAP with the return value of GAP set to success or fail, depending on if all tests passed (defaults to <code class="keyw">false</code>).</p>
1438
1439 </dd>
1440 </dl>
1441 <p>See also <code class="func">TestPackage</code> (<a href="chap76.html#X866ADD4E814A54F0"><span class="RefLink">76.3-5</span></a>) for the information on running standard tests for <strong class="pkg">GAP</strong> packages.</p>
1442
1443 <p><a id="X85FF55448787CCA0" name="X85FF55448787CCA0"></a></p>
1444
1445 <h4>7.11 <span class="Heading">Debugging Recursion</span></h4>
1446
1447 <p>The <strong class="pkg">GAP</strong> interpreter monitors the level of nesting of <strong class="pkg">GAP</strong> functions during execution. By default, whenever this nesting reaches a multiple of <span class="SimpleMath">5000</span>, <strong class="pkg">GAP</strong> enters a break loop (<a href="chap6.html#X8593B49F8705B486"><span class="RefLink">6.4</span></a>) allowing you to terminate the calculation, or enter <strong class="button">Return</strong><code class="code">;</code> to continue it.</p>
1448
1449
1450 <div class="example"><pre>
1451 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive:= function(depth) if depth&gt;1 then dive(depth-1); fi; return; end;</span>
1452 function( depth ) ... end
1453 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(100);</span>
1454 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">OnBreak:= function() Where(2); end;; # shorter traceback</span>
1455 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(6000);</span>
1456 Error, recursion depth trap (5000)
1457 *[1] dive( depth - 1 );
1458 @ *stdin*:1
1459 [2] dive( depth - 1 );
1460 @ *stdin*:1
1461 ... at *stdin*:4
1462 you may 'return;'
1463 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">return;</span>
1464 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(11000);</span>
1465 Error, recursion depth trap (5000)
1466 *[1] dive( depth - 1 );
1467 @ *stdin*:1
1468 [2] dive( depth - 1 );
1469 @ *stdin*:1
1470 ... at *stdin*:5
1471 you may 'return;'
1472 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">return;</span>
1473 Error, recursion depth trap (10000)
1474 *[1] dive( depth - 1 );
1475 @ *stdin*:1
1476 [2] dive( depth - 1 );
1477 @ *stdin*:1
1478 ... at *stdin*:5
1479 you may 'return;'
1480 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">return;gap&gt;</span>
1481 </pre></div>
1482
1483 <p>This behaviour can be controlled using the following procedures.</p>
1484
1485 <p><a id="X7D8968FC7E24A4E5" name="X7D8968FC7E24A4E5"></a></p>
1486
1487 <h5>7.11-1 SetRecursionTrapInterval</h5>
1488
1489 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetRecursionTrapInterval</code>( <var class="Arg">interval</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1490 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GetRecursionDepth</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1491 <p><code class="func">GetRecursionDepth</code> returns the nesting level of the GAP interpreter. This is reset to 0 every time the break loop is entered. <code class="func">SetRecursionTrapInterval</code> sets the depth of the stack at which GAP will enter the Break loop. <var class="Arg">interval</var> must be a non-negative small integer (between 0 and <span class="SimpleMath">2^28</span>). An <var class="Arg">interval</var> of 0 suppresses the monitoring of recursion altogether. In this case excessive recursion may cause <strong class="pkg">GAP</strong> to crash.</p>
1492
1493
1494 <div class="example"><pre>
1495 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">GetRecursionDepth();</span>
1496 0
1497 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive := function(depth)</span>
1498 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> if depth&gt;1 then</span>
1499 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> dive(depth-1);</span>
1500 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> else</span>
1501 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> Print("Depth ", GetRecursionDepth());</span>
1502 <span class="GAPprompt">&gt;</span> <span class="GAPinput"> fi;</span>
1503 <span class="GAPprompt">&gt;</span> <span class="GAPinput">end;;</span>
1504 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetRecursionTrapInterval(1000);</span>
1505 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">OnBreak:= function() Where(2); end;; # shorter traceback</span>
1506 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(100);</span>
1507 Depth 100
1508 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(2500);</span>
1509 Error, recursion depth trap (1000)
1510 *[1] dive( depth - 1 );
1511 @ *stdin*:4
1512 [2] dive( depth - 1 );
1513 @ *stdin*:4
1514 ... at *stdin*:12
1515 you may 'return;'
1516 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">return;</span>
1517 Error, recursion depth trap (2000)
1518 *[1] dive( depth - 1 );
1519 @ *stdin*:4
1520 [2] dive( depth - 1 );
1521 @ *stdin*:4
1522 ... at *stdin*:12
1523 you may 'return;'
1524 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">GetRecursionDepth();</span>
1525 0
1526 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">return;</span>
1527 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetRecursionTrapInterval(2^50);</span>
1528 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(20000);</span>
1529 Depth 20000
1530 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">dive(2000000);</span>
1531 Segmentation fault
1532 </pre></div>
1533
1534 <p><a id="X85679F17791D9B63" name="X85679F17791D9B63"></a></p>
1535
1536 <h4>7.12 <span class="Heading">Global Memory Information</span></h4>
1537
1538 <p><a id="X7F1F741D7F0899D1" name="X7F1F741D7F0899D1"></a></p>
1539
1540 <h5>7.12-1 <span class="Heading">Garbage Collection</span></h5>
1541
1542 <p>The <strong class="pkg">GAP</strong> environment provides automatic memory management, so that the programmer does not need to concern themselves with allocating space for objects, or recovering space when objects are no longer needed. The memory manager that shall be used by <strong class="pkg">GAP</strong> is specified at compile time. One of the choices is called <code class="code">GASMAN</code> (<strong class="pkg">GAP</strong> Storage MANager). (The name of the currently used garbage collector is stored in the variable <code class="code">GAPInfo.KernelInfo.GC</code>.)</p>
1543
1544 <p>If <strong class="pkg">GAP</strong> uses <code class="code">GASMAN</code> then messages reporting garbage collections performed by <code class="code">GASMAN</code> can be switched on by the <code class="code">-g</code> command line option (see section <a href="chap3.html#X782751D5858A6EAF"><span class="RefLink">3.1</span></a>). There are also some facilities to access information from <code class="code">GASMAN</code> from <strong class="pkg">GAP</strong> programs, see below.</p>
1545
1546 <p><a id="X7848AB367F3A1221" name="X7848AB367F3A1221"></a></p>
1547
1548 <h5>7.12-2 CollectGarbage</h5>
1549
1550 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CollectGarbage</code>( <var class="Arg">full</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1551 <p>Returns: nothing.</p>
1552
1553 <p>This function forces a garbage collection. If <var class="Arg">full</var> is <code class="keyw">true</code> then it triggers a full garbage collection, otherwise a partial one.</p>
1554
1555 <p><strong class="pkg">GAP</strong> invokes its garbage collector automatically, thus there is normally no need to call <code class="func">CollectGarbage</code>.</p>
1556
1557 <p>The function <code class="func">CollectGarbage</code> was introduced in <strong class="pkg">GAP</strong> 4.12. In older <strong class="pkg">GAP</strong> versions, one can use <code class="code">GASMAN( "collect" )</code> (if <var class="Arg">full</var> is <code class="keyw">true</code>) or <code class="code">GASMAN( "partial" )</code> (if <var class="Arg">full</var> is not <code class="keyw">true</code>) instead.</p>
1558
1559
1560 <div class="example"><pre>
1561 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CollectGarbage( false );</span>
1562 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CollectGarbage( true );</span>
1563 </pre></div>
1564
1565 <p><a id="X836977DE80416F3D" name="X836977DE80416F3D"></a></p>
1566
1567 <h5>7.12-3 GasmanStatistics</h5>
1568
1569 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GasmanStatistics</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1570 <p>This function is meaningful only if <code class="code">GASMAN</code> is the garbage collector used by <strong class="pkg">GAP</strong>, see Section <a href="chap7.html#X7F1F741D7F0899D1"><span class="RefLink">7.12-1</span></a>.</p>
1571
1572 <p><code class="func">GasmanStatistics</code> returns a record containing some information from the garbage collection mechanism. The record may contain up to four components: <code class="code">full</code>, <code class="code">partial</code>, <code class="code">npartial</code>, and <code class="code">nfull</code>.</p>
1573
1574 <p>The <code class="code">full</code> component will be present if a full garbage collection has taken place since <strong class="pkg">GAP</strong> started. It contains information about the most recent full garbage collection. It is a record, with eight components: <code class="code">livebags</code> contains the number of bags which survived the garbage collection; <code class="code">livekb</code> contains the total number of kilobytes occupied by those bags; <code class="code">deadbags</code> contains the total number of bags which were reclaimed by that garbage collection and all the partial garbage collections preceding it, since the previous full garbage collection; <code class="code">deadkb</code> contains the total number of kilobytes occupied by those bags; <code class="code">freekb</code> reports the total number of kilobytes available in the <strong class="pkg">GAP</strong> workspace for new objects; <code class="code">totalkb</code> reports the actual size of the workspace; <code class="code">time</code> reports the CPU time in milliseconds spent on the last garbage collection and <code class="code">cumulative</code> the total CPU time in milliseconds spent on that type of garbage collection since <strong class="pkg">GAP</strong> started.</p>
1575
1576 <p>These figures should be viewed with some caution. They are stored internally in fixed length integer formats, and <code class="code">deadkb</code> and <code class="code">deadbags</code> are liable to overflow if there are many partial collections before a full collection. Also, note that <code class="code">livekb</code> and <code class="code">freekb</code> will not usually add up to <code class="code">totalkb</code>. The difference is essentially the space overhead of the memory management system.</p>
1577
1578 <p>The <code class="code">partial</code> component will be present if there has been a partial garbage collection since the last full one. It is also a record with the same six components as <code class="code">full</code>. In this case <code class="code">deadbags</code> and <code class="code">deadkb</code> refer only to the number and total size of the garbage bags reclaimed in this partial garbage collection and <code class="code">livebags</code>and <code class="code">livekb</code> only to the numbers and total size of the young bags that were considered for garbage collection, and survived.</p>
1579
1580 <p>The <code class="code">npartial</code> and <code class="code">nfull</code> components will contain the number of full and partial garbage collections performed since <strong class="pkg">GAP</strong> started.</p>
1581
1582 <p><a id="X85327FA5872E0356" name="X85327FA5872E0356"></a></p>
1583
1584 <h5>7.12-4 GasmanMessageStatus</h5>
1585
1586 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GasmanMessageStatus</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1587 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetGasmanMessageStatus</code>( <var class="Arg">stat</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1588 <p>This function is meaningful only if <code class="code">GASMAN</code> is the garbage collector used by <strong class="pkg">GAP</strong>, see Section <a href="chap7.html#X7F1F741D7F0899D1"><span class="RefLink">7.12-1</span></a>.</p>
1589
1590 <p><code class="func">GasmanMessageStatus</code> returns one of the strings <code class="code">"none"</code>, <code class="code">"full"</code>, or <code class="code">"all"</code>, depending on whether the garbage collector is currently set to print messages on no collections, full collections only, or all collections, respectively.</p>
1591
1592 <p>Calling <code class="func">SetGasmanMessageStatus</code> with the argument <var class="Arg">stat</var>, which should be one of the three strings mentioned above, sets the garbage collector messaging level.</p>
1593
1594 <p><a id="X80C683247E94769F" name="X80C683247E94769F"></a></p>
1595
1596 <h5>7.12-5 GasmanLimits</h5>
1597
1598 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; GasmanLimits</code>( )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1599 <p>This function is meaningful only if <code class="code">GASMAN</code> is the garbage collector used by <strong class="pkg">GAP</strong>, see Section <a href="chap7.html#X7F1F741D7F0899D1"><span class="RefLink">7.12-1</span></a>.</p>
1600
1601 <p><code class="func">GasmanLimits</code> returns a record with three components: <code class="code">min</code> is the minimum workspace size as set by the <code class="code">-m</code> command line option in kilobytes. The workspace size will never be reduced below this by the garbage collector. <code class="code">max</code> is the maximum workspace size, as set by the <code class="code">-o</code> command line option, also in kilobytes. If the workspace would need to grow past this point, <strong class="pkg">GAP</strong> will enter a break loop to warn the user. A value of 0 indicates no limit. <code class="code">kill</code> is the absolute maximum, set by the <code class="code">-K</code> command line option. The workspace will never be allowed to grow past this limit.</p>
1602
1603
1604 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap6.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap8.html">[Next Chapter]</a>&nbsp; </div>
1605
1606
1607 <div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
1608
1609 <hr />
1610 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
1611 </body>
1612 </html>