• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by anilhdas · Feb 02 at 01:53 PM · profilerdots

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: alt text

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)

delegateget-method.png (6.7 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image andrew-lukasik · Feb 02 at 03:34 PM 0
Share

Looks like reflection ( typeof(DelegateType).GetMethod("MethodName").Invoke(arguments))

avatar image anilhdas andrew-lukasik · Feb 03 at 03:55 PM 0
Share

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
    }
  }

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by andrew-lukasik · Feb 03 at 09:32 PM


Found it, mscorlib.dll!System::Delegate.get_Method():


link text

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 FixedUpdate


PlayerLoop.Update as well


Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

136 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How using Profiler with ECS Games(Physics)? -1 Answers

Wierd profiler hence in GPU 0 Answers

Bottleneck not shown in Unity Profiler 1 Answer

Setting Active Profiler to WindowsPlayer does nothing 0 Answers

AnimatedGifDrawer 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges