• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 0.X Spells running slow at stats

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,458
Solutions
17
Reaction score
175
Location
Brazil
Hello guys, since few hours ago some spells are executing slow, in my stats system. There's something can i do to improve? The spells code are so simply. For example, follow ultimate hur spell code:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_TELEPORT)
setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, -2.3, -0, -3.5, -0)

local area = createCombatArea(AREA_CROSS5X5)
setCombatArea(combat, area)

function onCastSpell(cid, var)
    return doCombat(cid, combat, var)
end

1731670154182.webp

Passing time seems to get worse:
Code:
[14/11/2024 23:55:21] Execution time: 74 ms - data/spells/scripts/attack/ultimate mort.lua:onCastSpell - <br>[14/11/2024 23:55:31] Execution time: 79 ms - data/spells/scripts/attack/gran berserk.lua:onCastSpell -

just playerSay was consuming 2% CPU:
Code:
[14/11/2024 22:58:13]
Thread: 1 Cpu usage: 9.83407% Idle: 90.1234% Other: 0.0425486% Players online: 27
 Time (ms)     Calls     Rel usage %    Real usage % Description
     10189      2997       34.53778%        3.39647% std::bind(&Game::checkCreatures, this)
      6248    176278       21.18038%        2.08289% std::bind(&Game::checkCreatureWalk, &g_game, id)
      6029     17958       20.43779%        2.00987% &Game::playerSay
      1589      1200        5.38847%        0.52991% std::bind(&Game::checkDecay, this)
      1268     11655        4.30129%        0.42299% &Game::playerMove
       891     12725        3.02291%        0.29727% std::bind(&Game::updateCreatureWalk, &g_game, getID())


There's something can i do to improve this numbers?
 
Passing time seems to get worse:
It's not spell problem. It's some loot/auto loot/on death script or someone kill other player with spell and it saves that player in database. You can look in SQL logs, if there are any slow queries in same second in which you get 'slow spell' in Lua/Dispatcher report.

As I described in How to read OTS Statistics logs (https://otland.net/threads/how-to-read-ots-statistics-logs.283722/)
One important thing: Lua events/C++ functions 'inside' other events/functions are not reported.
Ex. player cast spell UE, it kills player, killed player gets saved in database -> player has big depot, save takes 50 ms."
 
It's not spell problem. It's some loot/auto loot/on death script or someone kill other player with spell and it saves that player in database. You can look in SQL logs, if there are any slow queries in same second in which you get 'slow spell' in Lua/Dispatcher report.

As I described in How to read OTS Statistics logs (https://otland.net/threads/how-to-read-ots-statistics-logs.283722/)
Thanks for reply! There's nothing on SQL. Its slow at same time on dispatcher:

1731774589016.webp

Code:
[16/11/2024 12:19:7] Execution time: 11 ms - data/spells/scripts/attack/ultimate hur.lua:onCastSpell -
[16/11/2024 12:55:10] Execution time: 11 ms - data/spells/scripts/attack/gran berserk.lua:onCastSpell -
[16/11/2024 13:2:32] Execution time: 10 ms - data/spells/scripts/attack/gran berserk.lua:onCastSpell -
[16/11/2024 13:3:23] Execution time: 11 ms - data/spells/scripts/attack/gran berserk.lua:onCastSpell -
[16/11/2024 13:4:13] Execution time: 10 ms - data/spells/scripts/attack/ultimate hur.lua:onCastSpell -
[16/11/2024 13:7:56] Execution time: 10 ms - data/spells/scripts/attack/ultimate hur.lua:onCastSpell -
[16/11/2024 13:15:8] Execution time: 12 ms - data/spells/scripts/attack/ultimate hur.lua:onCastSpell -
[16/11/2024 13:16:6] Execution time: 10 ms - data/spells/scripts/attack/ultimate mort.lua:onCastSpell -
[16/11/2024 13:22:28] Execution time: 10 ms - data/spells/scripts/attack/ultimate hur.lua:onCastSpell -
 
Back
Top