File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 16321632 end
16331633
16341634 local function is_probably_lua (str )
1635- do
1636- return false
1637- end -- this is very buggy
16381635 local possible_statements = {
16391636 " %s*local%s" ,
16401637 " %s*return%s" ,
Original file line number Diff line number Diff line change 605605 end
606606end
607607
608+ function Profiler :GetSimpleSections ()--[[ #: Map<|string, {total = number}|>]]
609+ local times = {}
610+ local start_times = {}
611+
612+ for _ , event in ipairs (self ._events ) do
613+ if event .type == " section_start" then
614+ start_times [event .name ] = event .time
615+ elseif event .type == " section_end" then
616+ local start_time = start_times [event .name ]
617+
618+ if start_time then
619+ times [event .name ] = times [event .name ] or {total = 0 }
620+ times [event .name ].total = times [event .name ].total + (event .time - start_time )
621+ start_times [event .name ] = nil
622+ end
623+ end
624+ end
625+
626+ return times
627+ end
628+
608629function Profiler :Stop ()
609630 if not self ._running then return end
610631
You can’t perform that action at this time.
0 commit comments