- Home /
What does `Delegate.get_Method()` mean in the profiler?
Hi,
While trying to run a burst compiled job in main thread using job.Run()
I see the job is waiting for about 1.6 ms before executing the job (which takes only about 0.01 ms).
I notice that there's a call to Delegate.get_Method()
immediately after the wait before the job is run.
What does this mean?
The snapshot from timeline looks like this:
I'm using 2020.3 and this is being profiled in the target hardware (Android).
(PS: I'm not scheduling the job because I just want to use burst to speed it up a bit. I'm happy with it running in the main thread)
Looks like reflection ( typeof(DelegateType).GetMethod("MethodName").Invoke(arguments)
)
That's really strange, if true.!!
I don't understand why running a job in main thread should cause a reflection call?
For some context, this is what I'm doing: Do you spot something that should cause this?
public class MyComponent : MonoBehaviour
{
MyJob job;
void Start()
{
job = new MyJob();
// Initialize native container with Persistent allocator
}
void OnCollisionEnter(Collision collision)
{
int result = GetData();
// some more code
}
unsafe int GetData()
{
job.Initialize (/* input parameters */);
job.Run();
return job.Result[0];
}
void OnDestroy()
{
// Dispose the native container
}
}
[BurstCompile]
public unsafe struct MyJob : IJob
{
public float3* InputData;
public NativeArray Result;
public void Initialize ( /* input params */ )
{
// Setup input parameters
}
public void Execute()
{
// some costly vector math operation
}
}
Answer by andrew-lukasik · Feb 03 at 09:32 PM
Found it, mscorlib.dll!System::Delegate.get_Method()
:
As far as I can tell - it's part of Unity event system. But I'm not sure why it interfered with job execution in your case, might be caused by context switching due to delayed execution maybe, idk.
broader view:
PlayerLoop.Update as well
Your answer
Follow this Question
Related Questions
How using Profiler with ECS Games(Physics)? -1 Answers
iPhone profiler shows strange values. 1 Answer
Deep profile generating error and not giving frame 1 0 Answers
iOS: Compressed audio not affecting memory? 2 Answers
perfHUD & Unity 0 Answers