Add hook names to vprof
RaphaelIT7 opened this issue · 2 comments
RaphaelIT7 commented
Details
Currently, you cannot know which hooks CLuaGamemode::Call
, CLuaGamemode::CallWithArgs
and CLuaGamemode::CallFinish
call which should be changed.
They should include the hook name in Vprof which would allow one to make it far easier to find any performance issues.
This should be relatively easy to implement and it would be really useful.
Example implementation for CLuaGamemode::CallFinish
(same for other functions):
std::map<int, std::string> CallFinishStrs; // We need to save the std::string, because if it gets deleted VProf gets empty or garbage entries
void CLuaGamemode::CallFinish(int pool)
{
if (CallFinishStrs.find(pool) == CallFinishStrs.end())
{
std::string vprof = gLUA->GetPooledString(pool);
vprof = "CLuaGamemode::CallFinish (" + vprof + ")";
CallFinishStrs[pool] = vprof;
}
VPROF_BUDGET( CallFinishStrs[pool].c_str(), "GMOD" );
[...]
}
MorrowFOC commented
It Would be really useful !
NathanX-S commented
Bump