Is there a way to check individual hook time per plugin?
For example, I want to know the hook time for OnPlayerInput for a specific plugin total and per call. Is it possible?
I'm currently using this to see overall hook time per plugin since server start:
For example, I want to know the hook time for OnPlayerInput for a specific plugin total and per call. Is it possible?
I'm currently using this to see overall hook time per plugin since server start:
private void CommandPluginsTime(ConsoleSystem.Arg arg)
{
var player = arg?.Player();
if (player != null && !player.IsAdmin) return;
string name, time, percent, result = GetLangMessage("INFO.TITLE");
foreach(var plugin in plugins.PluginManager.GetPlugins().Where(x=> !x.IsCorePlugin).OrderByDescending(x=>x.TotalHookTime))
{
name = plugin.Filename?.Basename(null) ?? (!string.IsNullOrEmpty(plugin.Title) ? $"{plugin.Title.Replace(" ","")}.dll" : "N|A");
time = ((double)Math.Round(plugin.TotalHookTime, 2)).ToString("0.###");
percent = ((double)Math.Round((100f*plugin.TotalHookTime)/UnityEngine.Time.realtimeSinceStartup, 5)).ToString("0.###");
result += GetLangMessage("INFO.LINE").Replace("{NAME}", name).Replace("{TIME}", time).Replace("{PERCENT}", percent);
}
if (player != null)
PrintToConsole(player, result);
else
Puts(result);
}