File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ M.C = nil
21
21
22
22
function M .on_ui_enter ()
23
23
M ._stats .startuptime = M .track (" UIEnter" )
24
- M ._stats .startuptime_cputime = M .C . clock_gettime ~= nil
24
+ M ._stats .startuptime_cputime = M .C ~= false
25
25
vim .cmd ([[ do User LazyVimStarted]] )
26
26
end
27
27
33
33
34
34
function M .cputime ()
35
35
if M .C == nil then
36
+ M .C = false
36
37
pcall (function ()
37
38
ffi .cdef ([[
38
39
typedef long time_t;
@@ -43,10 +44,12 @@ function M.cputime()
43
44
} nanotime;
44
45
int clock_gettime(clockid_t clk_id, struct timespec *tp);
45
46
]] )
47
+ if M .C .clock_gettime then
48
+ M .C = ffi .C
49
+ end
46
50
end )
47
- M .C = ffi .C
48
51
end
49
- if M .C . clock_gettime then
52
+ if M .C then
50
53
local pnano = assert (ffi .new (" nanotime[?]" , 1 ))
51
54
local CLOCK_PROCESS_CPUTIME_ID = jit .os == " OSX" and 12 or 2
52
55
ffi .C .clock_gettime (CLOCK_PROCESS_CPUTIME_ID , pnano )
You can’t perform that action at this time.
0 commit comments