Changes between Version 6 and Version 7 of Profiler


Ignore:
Timestamp:
Nov 8, 2010, 8:20:44 PM (8 years ago)
Author:
jd
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Profiler

    v6 v7  
    3232  * Show a '''search subtree profile''' by first selecting the root node of the desired subtree and then clicking '''Profile search subtree''' in the '''Profiler''' menu. A search subtree profile may be useful if you know that when control flow hit the root node, a "wrong" choice was made that will not lead to a solution. The profile then shows you the amount of unneccessary work done by the system after making the wrong decision and before failing and backtracking back past the wrong decision.
    3333  * Show a '''call subtree profile''' by first selecting the root node of the desired subtree and then clicking '''Profile call subtree''' in the '''Profiler''' menu. A call subtree profile may be useful for assessing the amount of work that executing a certain step requires, including all substeps.
    34 
    35 == Warn points ==
    36 
    37 Warn points allow for automatizing certain profiling tasks. With them, you can just let a program run, but stop automatically once the number of calls to a certain predicate (or the number of times a more complex control flow tree constellation has arisen) exceeds a predefined threshold. For example, you can define a number of calls to a certain predicate that you wouldn't expect your program to exceed, and if it does, this is indicatory of a problem. Moreover, the point at which execution is automatically halted because the threshold has been exceeded may indicate the part of execution where things go wrong, for example through infinite recursion.
    38 
    39 The warn point system has been integrated with Kahina's BreakpointSystem. This allows to combine arbitrary tree patterns with thresholds, although in typical cases a one-node tree pattern will do. A warn point is a breakpoint paired with a threshold and a counter. The counter starts at 0 and is incremented every time there is a match. Unlike a breakpoint match, a warn point match has no visible effect until the counter hits the threshold. Then, the counter is reset to 0 and Kahina shows the usual breakpoint match behavior: if Kahina is in auto-complete or leap mode, it goes into stop mode, thereby pausing execution of the program. Additionally, a dialog opens indicating which warn point has matched.
    40 
    41 Warn points are defined through the warn point editor. This editor is like the other breakpoint editors, except that it has an additional input field for specifiying the threshold.
    42 
    43 {{{
    44 #!html
    45 <div style="border: 1px solid grey; padding: 10px; background-color: #FFFFDD">
    46 <h3 style="margin-left: 0;">TRALE example</h3>
    47 }}}
    48 
    49 [[Image(Prenzlgram-warn-edit.png)]]
    50 
    51 Let's say your grammar contains the predicate {{{tree_append/3}}} and you want to be warned if it is called 1000 times. You can define a warn point as follows:
    52 
    53  1. Click '''Warn points (call tree)''' in the '''Breakpoints''' menu. (Since we are only defining a one-node tree pattern, it does not matter if we choose the call or step tree.)
    54  1. Click '''New'''.
    55  1. In the '''Node constraint''' area, select '''step label''' and '''contains''' and enter {{{tree_append/3}}}.
    56  1. Enter a catchy '''Name''' for the warn point, such as {{{1000x tree_append/3}}}.
    57  1. In the '''Warn after''' field, enter the threshold {{{1000}}}.
    58  1. Click '''Apply and quit''' in the '''Profile''' window.
    59 
    60 Now start the parse by clicking the leap (fast forward) button. After 1000 calls to {{{tree_append/3}}}, leaping stops and the following window appears:
    61 
    62 [[Image(Prenzlgram-warn-warn.png)]]
    63 {{{
    64 #!html
    65 </div>
    66 }}}