-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.lua
42 lines (33 loc) · 1.15 KB
/
test.lua
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
38
39
40
41
42
local args={...}
if MOAISim then
os.clock=MOAISim.getDeviceTime
end
require "tools.printtable"
-- setmetatable(_G,{__index=function(t,k) error("undefined symbol:"..k,2) end})
local t0=os.clock()
require "yu.yu"
local compilerloadtime=os.clock()-t0
t0=os.clock()
local builder=yu.newBuilder()
builder:setPreprocessorEnvironment{
DEBUG = true
}
local targetFile=args[1] or 'test/moai.yu'
builder:build((targetFile), true)
local buildtime=os.clock()-t0
t0=os.clock()
local codegentime=os.clock()-t0
print "---------------build time elapsed-----------"
print(string.format("\tloading: \t%.2f",compilerloadtime*1000))
print(string.format("\tparse: \t%.2f",yu.totalParseTime*1000))
print(string.format("\tdecl: \t%.2f",yu.totalDeclTime*1000))
print(string.format("\tresolve: \t%.2f",yu.totalResolveTime*1000))
print(string.format("\ttotalbuild:\t%.2f",buildtime*1000))
print(string.format("\tcodegen: \t%.2f",yu.totalGenerateTime*1000))
print "-------------------------------------------"
require 'yu.runtime'
local function stripExt(p)
p=string.gsub(p,'%..*$','')
return p
end
yu.runtime.run(stripExt(targetFile))