Skip to content

Commit

Permalink
Merging from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
raulssorban committed Apr 9, 2024
2 parents a2cbcab + 88a48f9 commit 9575f95
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon.Components/Carbon.Common.Client
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon.Hooks/Carbon.Hooks.Base
16 changes: 9 additions & 7 deletions Carbon.Core/Carbon/src/Hooks/HookCallerInternal.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Carbon.Base;
using Carbon.Components;
using Carbon.Extensions;
using Carbon.Pooling;
using Facepunch;
using Oxide.Core.Plugins;
using UnityEngine;
using static Carbon.Base.BaseHookable;

/*
Expand Down Expand Up @@ -128,7 +130,7 @@ public override object CallHook<T>(T hookable, uint hookId, BindingFlags flags,
#endif

hookable.TrackStart();
var beforeMemory = hookable.TotalMemoryUsed;
var beforeMemory = CurrentMemory;

if (hook != null && hook.IsAsync)
{
Expand All @@ -147,14 +149,14 @@ public override object CallHook<T>(T hookable, uint hookId, BindingFlags flags,
}

var afterHookTime = hookable.CurrentHookTime;
var afterMemory = hookable.TotalMemoryUsed;
var totalMemory = afterMemory - beforeMemory;
var afterMemory = CurrentMemory;
var totalMemory = Mathf.Abs(afterMemory - beforeMemory);

#if DEBUG
Profiler.EndHookCall(hookable);
#endif

hook?.OnFired(afterHookTime, totalMemory);
hook?.OnFired(hookable, afterHookTime, totalMemory);

var afterHookTimeMs = afterHookTime.TotalMilliseconds;

Expand All @@ -168,7 +170,7 @@ public override object CallHook<T>(T hookable, uint hookId, BindingFlags flags,

if (wasLagSpike)
{
hook?.OnLagSpike();
hook?.OnLagSpike(hookable);
}

Analytics.plugin_time_warn(readableHook, basePlugin, afterHookTimeMs, totalMemory, hook, hookable, wasLagSpike);
Expand Down Expand Up @@ -260,7 +262,7 @@ static object DoCall(T hookable, uint hookId, CachedHook hook, object[] args, re
var afterMemory = hookable.TotalMemoryUsed;
var totalMemory = afterMemory - beforeMemory;

hook.OnFired(afterHookTime, totalMemory);
hook.OnFired(hookable, afterHookTime, totalMemory);

var afterHookTimeMs = afterHookTime.TotalMilliseconds;

Expand All @@ -275,7 +277,7 @@ static object DoCall(T hookable, uint hookId, CachedHook hook, object[] args, re

if (wasLagSpike)
{
hook.OnLagSpike();
hook.OnLagSpike(hookable);
}

Analytics.plugin_time_warn(readableHook, basePlugin, afterHookTimeMs, totalMemory, hook, hookable, wasLagSpike);
Expand Down

0 comments on commit 9575f95

Please sign in to comment.