Get individual hook times per plugin?
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:


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);
}
You can add a timer to the start and end of it, or do some voodoo with reflection (won't always be possible) to fiddle around with the core. What you have now is probably the best though, there isn't really much else.
In response to Wulf ():
You can add a timer to the start and end of it, or do some voodoo with reflection (won't always be p...
I see. Do you have a go-to method that you use for testing? 

[quote]What you have now is probably the best though, there isn't really much else.[/quote]

Maybe it could be improved a little by saving previous state and compare it with the next state when you execute "pluginstime" again, (new_hooktime - old_hooktime)/dTime. That way it's easier to see improvements (hooktime/time), ignore initilization and possibly GC events depending on when you execute.
In response to haggbart ():
I see. Do you have a go-to method that you use for testing? 

[quote]What you have now is...
I don't haven't anything, sorry.