bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

32-bit profiling counts?


From: Peter Lindgren
Subject: 32-bit profiling counts?
Date: Fri, 5 Jun 2020 15:44:10 +0000 (UTC)

I've been profiling a very long-running gawk program, and after some time the 
counts of the innermost loops roll over to negative numbers. I wonder whether 
the profile counts are 32-bit signed integers? Could you confirm this? And what 
do you think about changing them to 64-bit integers?

This isn't my original program, but one designed just to show this issue:



        # gawk profile, created Fri Jun  5 09:17:14 2020


        # BEGIN rule(s)


        BEGIN {
     1          two31plus1 = (1024 * 1024 * 1024 * 2) + 1
     1          status = 1024 * 1024 * 128
-2147483647     for (x = 1; x <= two31plus1; x++) {
-2147483647             if (! (x % status)) { # 16
    16                          print "Status: " x
                        }
                }
        }


Where stdout was:

pi@pi2:~/Documents/words $ gawk --profile=myprof.out -f profile32.awk  
/dev/null 
Status: 134217728
Status: 268435456
Status: 402653184
Status: 536870912
Status: 671088640
Status: 805306368
Status: 939524096
Status: 1073741824
Status: 1207959552
Status: 1342177280
Status: 1476395008
Status: 1610612736
Status: 1744830464
Status: 1879048192
Status: 2013265920
Status: 2147483648


 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]