-
-
Save nbhatti/506cd0e568888df938f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local t_sum = 0 | |
local t_num = 0 | |
local t1, t2, t3 | |
local do_time = true | |
local function mark1() | |
if not do_time then return end | |
t1 = os.clock() | |
end | |
local function mark2() | |
if not do_time then return end | |
t2 = os.clock() | |
end | |
local function mark3() | |
if not do_time then return end | |
t3 = os.clock() | |
print('---') | |
print(string.format('t1-t3 took %gs', t3 - t1)) | |
print(string.format('t1-t2 took %gs', t2 - t1)) | |
print(string.format('t2-t3 took %gs', t3 - t2)) | |
t_sum = t_sum + t3 - t1 | |
t_num = t_num + 1 | |
print(string.format('avg t1-t3 is now %gs', t_sum / t_num)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment