webmcp
diff framework/env/trace/exectime.lua @ 41:0bbfee4d4aed
New functions trace.disable() and trace.is_disabled()
author | jbe |
---|---|
date | Sat Oct 16 17:51:18 2010 +0200 (2010-10-16) |
parents | 9fdfb27f8e67 |
children |
line diff
1.1 --- a/framework/env/trace/exectime.lua Sat Oct 16 17:49:11 2010 +0200 1.2 +++ b/framework/env/trace/exectime.lua Sat Oct 16 17:51:18 2010 +0200 1.3 @@ -9,13 +9,15 @@ 1.4 --]]-- 1.5 1.6 function trace.exectime(args) 1.7 - local real = args.real 1.8 - local cpu = args.cpu 1.9 - if type(real) ~= "number" then 1.10 - error("Called trace.exectime{...} without numeric 'real' argument.") 1.11 + if not trace._disabled then 1.12 + local real = args.real 1.13 + local cpu = args.cpu 1.14 + if type(real) ~= "number" then 1.15 + error("Called trace.exectime{...} without numeric 'real' argument.") 1.16 + end 1.17 + if type(cpu) ~= "number" then 1.18 + error("Called trace.exectime{...} without numeric 'cpu' argument.") 1.19 + end 1.20 + trace._new_entry{ type = "exectime", real = args.real, cpu = args.cpu } 1.21 end 1.22 - if type(cpu) ~= "number" then 1.23 - error("Called trace.exectime{...} without numeric 'cpu' argument.") 1.24 - end 1.25 - trace._new_entry{ type = "exectime", real = args.real, cpu = args.cpu } 1.26 end