Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook names to vprof #2374

Open
RaphaelIT7 opened this issue Apr 30, 2024 · 1 comment
Open

Add hook names to vprof #2374

RaphaelIT7 opened this issue Apr 30, 2024 · 1 comment

Comments

@RaphaelIT7
Copy link

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" );

	[...]
}
@RaphaelIT7 RaphaelIT7 changed the title Add hook names calls to vprof Add hook names to vprof Apr 30, 2024
@MorrowFOC
Copy link

It Would be really useful !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants