-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_leak.lua
More file actions
37 lines (33 loc) · 862 Bytes
/
check_leak.lua
File metadata and controls
37 lines (33 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--
-- Copyright (c) 2009,2010, Cloudkick, Inc.
-- All right reserved.
--
module(..., package.seeall);
local util = require 'util'
local Check = util.Check
local nicesize = util.nicesize
local log = util.log
local function getvalue(args)
local r = {}
equus.win32_mem_checkpoint()
equus.win32_mem_difference()
r["mem_total"] = equus.win32_mem_values()
return r
end
function run(rcheck, args)
if equus.p_is_windows() == 0 then
rcheck:set_error("memory leak check is only supported on windows")
return rcheck
end
local rv, r = pcall(getvalue, args)
if rv then
for k,v in pairs(r) do
rcheck:add_metric(k, v, Check.enum.uint64)
end
rcheck:set_status("memory value:%s", nicesize(tonumber(r["mem_total"])))
else
log.err("memory check failed: %s", tostring(r))
rcheck:set_error("%s", r)
end
return rcheck
end