version 1.2, 2004/08/23 14:03:52
|
version 1.5, 2007/12/31 19:02:24
|
Line 1
|
Line 1
|
\ count execution of control-flow edges |
\ count execution of control-flow edges |
|
|
\ Copyright (C) 2004 Free Software Foundation, Inc. |
\ Copyright (C) 2004,2007 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
\ Gforth is free software; you can redistribute it and/or |
\ Gforth is free software; you can redistribute it and/or |
\ modify it under the terms of the GNU General Public License |
\ modify it under the terms of the GNU General Public License |
\ as published by the Free Software Foundation; either version 2 |
\ as published by the Free Software Foundation, either version 3 |
\ of the License, or (at your option) any later version. |
\ of the License, or (at your option) any later version. |
|
|
\ This program is distributed in the hope that it will be useful, |
\ This program is distributed in the hope that it will be useful, |
Line 15
|
Line 15
|
\ GNU General Public License for more details. |
\ GNU General Public License for more details. |
|
|
\ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
\ along with this program; if not, write to the Free Software |
\ along with this program. If not, see http://www.gnu.org/licenses/. |
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
|
|
|
\ relies on some Gforth internals |
\ relies on some Gforth internals |
Line 28
|
Line 27
|
|
|
true constant count-calls? \ do some profiling of colon definitions etc. |
true constant count-calls? \ do some profiling of colon definitions etc. |
|
|
|
\ for true COUNT-CALLS?: |
|
|
|
\ What data do I need for evaluating the effectiveness of (partial) inlining? |
|
|
|
\ static and dynamic counts of everything: |
|
|
|
\ original BB length (histogram and average) |
|
\ BB length with partial inlining (histogram and average) |
|
\ since we cannot partially inline library calls, we use a parameter |
|
\ that represents the amount of partial inlining we can expect there. |
|
\ number of tail calls (original and after partial inlining) |
|
\ number of calls (original and after partial inlining) |
|
\ reason for BB end: call, return, execute, branch |
|
|
|
\ how many static calls are there to a word? How many of the dynamic |
|
\ calls call just a single word? |
|
|
struct |
struct |
cell% field profile-next |
cell% field profile-next |
cell% 2* field profile-count |
cell% 2* field profile-count |
cell% 2* field profile-sourcepos |
cell% 2* field profile-sourcepos |
cell% field profile-char \ character position in line |
cell% field profile-char \ character position in line |
count-calls? [if] |
count-calls? [if] |
cell% field profile-colondef? \ is this a colon definition |
cell% field profile-colondef? \ is this a colon definition start |
cell% field profile-calls \ static calls to the colon def |
cell% field profile-calls \ static calls to the colon def |
cell% field profile-straight-line \ may contain calls, but no other CF |
cell% field profile-straight-line \ may contain calls, but no other CF |
cell% field profile-calls-from \ static calls in the colon def |
cell% field profile-calls-from \ static calls in the colon def |
Line 155 Defer before-word-profile ( -- )
|
Line 171 Defer before-word-profile ( -- )
|
r> ! ; \ change hook behaviour |
r> ! ; \ change hook behaviour |
|
|
hook-profiling-into then-like |
hook-profiling-into then-like |
\ hook-profiling-into if-like |
\ hook-profiling-into if-like \ subsumed by other-control-flow |
\ hook-profiling-into ahead-like |
\ hook-profiling-into ahead-like \ subsumed by other-control-flow |
hook-profiling-into other-control-flow |
hook-profiling-into other-control-flow |
hook-profiling-into begin-like |
hook-profiling-into begin-like |
hook-profiling-into again-like |
hook-profiling-into again-like |