|
1 | | --- logInfo(infos_string) -- will log a message with level INFOS in the in app console |
2 | | --- logWarning(warning_string) -- will log a message with level WARNING in app console |
3 | | --- logError(error_string) -- will log a message with level ERROR in app console |
| 1 | +-- UserDatas ltg (LogToGraph valid only from LogToGraph) |
| 2 | +-- ltg:logInfo(infos_string) : will log the message in the in app console |
| 3 | +-- ltg:logWarning(infos_string) : will log the message in the in app console |
| 4 | +-- ltg:logError(infos_string) : will log the message in the in app console |
| 5 | +-- ltg:logDebug(infos_string) : will log the message in the in app console |
| 6 | +-- ltg:addSignalTag(date, r, g, b, a, name, help) : add a signal tag with date, color a name (color is linear [0:1]. the help will be displayed when mouse over the tag |
| 7 | +-- ltg:addSignalStatus(signal_category, signal_name, signal_epoch_time, signal_status) : will add a signal string status |
| 8 | +-- ltg:addSignalValue(signal_category, signal_name, signal_epoch_time, signal_value, description_string_optional) : will add a signal numerical value |
| 9 | +-- ltg:addSignalStartZone(signal_category, signal_name, signal_epoch_time, signal_string) : will add a signal start zone |
| 10 | +-- ltg:addSignalEndZone(signal_category, signal_name, signal_epoch_time, signal_string) : will add a signal end zone |
| 11 | +-- get/set epoch time from datetime in format "YYYY-MM-DD HH:MM:SS,MS" or "YYYY-MM-DD HH:MM:SS.MS" with hour offset in second param |
| 12 | +-- double ltg:stringToEpoch("2023-01-16 15:24:26,464", 0) |
| 13 | +-- string ltg:epochToString(18798798465465.546546, 0) |
| 14 | +-- regex (boost::regex engine, PCRE-like syntax — supports |, {m,n}, lookahead, etc.): |
| 15 | +-- local re = ltg:regex(pattern) -- compile once at script init, reuse on every row |
| 16 | +-- re:test(input) -> bool |
| 17 | +-- re:match(input) -> captures (multiple values), or nil |
| 18 | +-- re:find(input) -> start, end (1-based), or nil |
| 19 | +-- re:gsub(input, repl) -> result, count (mirrors string.gsub) |
| 20 | +-- re:gmatch(input) -> iterator (for use in `for cap in re:gmatch(s) do ... end`) |
4 | 21 |
|
5 | | --- getRowIndex() -- return the row number of the file |
6 | | --- getRowCount() -- return the number of rows of the file |
7 | | - |
8 | | --- stringToEpoch(string epoch, double hour_offset) |
9 | | --- epochToString(Epoch epoch_time, double hour_offset) |
10 | | - |
11 | | --- add a signal tag with date, color a name. the help will be displayed when mouse over the tag |
12 | | --- addSignalTag(Epoch date, double r, double g, double b, double a, string name, string help) |
13 | | - |
14 | | --- addSignalStatus(string signal_category, string signal_name, Epoch signal_epoch_time, string signal_status) |
15 | | --- addSignalValue(string signal_category, string signal_name, Epoch signal_epoch_time, double signal_value) |
16 | | --- addSignalStartZone(string signal_category, string signal_name, Epoch signal_epoch_time, string signal_string) |
17 | | --- addSignalEndZone(string signal_category, string signal_name, Epoch signal_epoch_time, string signal_string) |
18 | | - |
19 | | -function startFile() |
20 | | - --RecursPrint(ltg) |
21 | | - ltg:logInfo(" --- Start of file parsing ---"); |
| 22 | +function startFile(filepath) |
| 23 | + ltg:logInfo(" --- Start parsing of file '" .. filepath .. "'"); |
22 | 24 | end |
23 | 25 |
|
24 | 26 | function parse(buffer) |
25 | 27 | _section, _time, _name, _value = string.match(buffer, "<profiler section=\"(.*)\" epoch_time=\"(.*)\" name=\"(.*)\" render_time_ms=\"(.*)\">") |
26 | 28 | if _section ~= nil and _time ~= nil and _name ~= nil and _value ~= nil then |
27 | | - ltg:addSignalValue(_section, _name, ltg:stringToEpoch(_time, 0), tonumber(_value)) |
| 29 | + ltg:addSignalValue(_section, _name, tonumber(_time), tonumber(_value)) |
28 | 30 | end |
29 | 31 | end |
30 | 32 |
|
31 | | -function endFile() |
32 | | - ltg:logInfo(" --- End of file parsing ---"); |
| 33 | +function endFile(filepath) |
| 34 | + ltg:logInfo(" --- End parsing of file '" .. filepath .. "'"); |
33 | 35 | end |
0 commit comments