Skip to content

Commit 140bc3c

Browse files
committed
-
1 parent 0cf31d7 commit 140bc3c

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

doc/log_parsing.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ function startFile(filepath)
2323
ltg:logInfo(" --- Start parsing of file '" .. filepath .. "'");
2424
end
2525

26+
local re = ltg:regex([[<profiler section="([^"]*)" epoch_time="([^"]*)" name="([^"]*)" render_time_ms="([^"]*)">]])
27+
2628
function parse(buffer)
27-
_section, _time, _name, _value = string.match(buffer, "<profiler section=\"(.*)\" epoch_time=\"(.*)\" name=\"(.*)\" render_time_ms=\"(.*)\">")
28-
if _section ~= nil and _time ~= nil and _name ~= nil and _value ~= nil then
29-
ltg:addSignalValue(_section, _name, tonumber(_time), tonumber(_value))
30-
end
29+
local section, time, name, value = re:match(buffer)
30+
if section and time and name and value then
31+
local epoch = ltg:stringToEpoch(time, 0);
32+
ltg:addSignalValue(section, name, epoch, tonumber(value))
33+
end
3134
end
3235

3336
function endFile(filepath)

doc/samples.ltg

16 KB
Binary file not shown.

0 commit comments

Comments
 (0)