Changeset 5113

Show
Ignore:
Timestamp:
07/23/09 04:19:46 (4 years ago)
Author:
jow
Message:

libs/core: debug.lua use integers for memory size and peak value

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/core/luasrc/debug.lua

    r5101 r5113  
    11local debug = require "debug" 
    22local io = require "io" 
    3 local collectgarbage = collectgarbage 
     3local collectgarbage, floor = collectgarbage, math.floor 
    44 
    55module "luci.debug" 
     
    1414    local function trap(what, line) 
    1515        local info = debug.getinfo(2, "Sn") 
    16         if collectgarbage("count") > peak then 
    17             peak = collectgarbage("count") 
     16        local size = floor(collectgarbage("count")) 
     17        if size > peak then 
     18            peak = size 
    1819        end 
    1920        if tracefile then 
     
    2223                (info.namewhat or ""), "\t", 
    2324                (info.name or ""), "\t", 
    24                 collectgarbage("count"), " (", peak, ")\n" 
     25                size, " (", peak, ")\n" 
    2526            ) 
    2627        end