aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/train_sections.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-12-05 10:14:07 +0100
committerorwell96 <orwell@bleipb.de>2019-12-05 10:15:36 +0100
commiteeef07d05a7e53de469f19a23fe1e69f569fc924 (patch)
tree6330ae717f337ec1a039004349d9c4c045ab632c /advtrains_interlocking/train_sections.lua
parent9c1d3565058799f21b6985c100ccf1abe045d3da (diff)
downloadadvtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.tar.gz
advtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.tar.bz2
advtrains-eeef07d05a7e53de469f19a23fe1e69f569fc924.zip
Add profiling instructions for advprofiler
Diffstat (limited to 'advtrains_interlocking/train_sections.lua')
-rw-r--r--advtrains_interlocking/train_sections.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/advtrains_interlocking/train_sections.lua b/advtrains_interlocking/train_sections.lua
index 757f36a..5e5945a 100644
--- a/advtrains_interlocking/train_sections.lua
+++ b/advtrains_interlocking/train_sections.lua
@@ -62,6 +62,7 @@ local function itkremove(tbl, ikey, com)
end
local function setsection(tid, train, ts_id, ts, sigd)
+ advtrains.interlocking.profiler:enter("train_setsection")
-- train
if not train.il_sections then train.il_sections = {} end
if not itkexist(train.il_sections, "ts_id", ts_id) then
@@ -106,9 +107,11 @@ local function setsection(tid, train, ts_id, ts, sigd)
if tcbs.signal then
advtrains.interlocking.route.update_route(sigd, tcbs)
end
+ advtrains.interlocking.profiler:leave("train_setsection")
end
local function freesection(tid, train, ts_id, ts)
+ advtrains.interlocking.profiler:enter("train_freesection")
-- train
if not train.il_sections then train.il_sections = {} end
itkremove(train.il_sections, "ts_id", ts_id)
@@ -129,6 +132,7 @@ local function freesection(tid, train, ts_id, ts)
-- This must be delayed, because this code is executed in-between a train step
-- TODO use luaautomation timers?
minetest.after(0, advtrains.interlocking.route.update_waiting, "ts", ts_id)
+ advtrains.interlocking.profiler:leave("train_freesection")
end