[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Profiling bug related to indirect function calls
From: |
Hermann Peifer |
Subject: |
Re: Profiling bug related to indirect function calls |
Date: |
Fri, 11 Feb 2011 20:56:09 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
On 11/02/2011 18:19, Hermann Peifer wrote:
Hi Arnold,
Here a small profiling issue.
Regards, Hermann
$ awk --profile '
BEGIN { the_func = "p" ; print @the_func("Hello") }
function p(str){ print "! " str " !" }'
! Hello !
$ awk -f ./awkprof.out
! p !
$ cat awkprof.out
# gawk profile, created Fri Feb 11 18:16:00 2011
# BEGIN block(s)
BEGIN {
the_func = "p"
print @the_func(the_func)
}
# Functions, listed alphabetically
function p(str)
{
print "! " str " !"
}
$ awk --version | head -1
GNU Awk 3.1.80
I just saw that the second lint warning is obviously wrong (whereas the
execution counts are correct).
Hermann
$ pgawk --lint '
BEGIN { the_func = "p" ; while (c++ < 3) @the_func("Hello") }
function p(str){ print "! " str " !" }' && cat awkprof.out
pgawk: cmd. line:2: warning: indirect function calls are a gawk extension
pgawk: warning: function `p' defined but never called
pgawk: cmd. line:2: warning: reference to uninitialized variable `c'
! Hello !
! Hello !
! Hello !
# gawk profile, created Fri Feb 11 20:47:05 2011
# BEGIN block(s)
BEGIN {
1 the_func = "p"
3 while (c++ < 3) {
3 @the_func(the_func)
}
}
# Functions, listed alphabetically
3 function p(str)
{
3 print "! " str " !"
}