Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to know how much job time used on thread sync of NativeContainers?

Discussion in 'Entity Component System' started by TMPxyz, Jul 11, 2019.

  1. TMPxyz

    TMPxyz

    Joined:
    Jul 20, 2012
    Posts:
    766
    Hi,

    I've doubt that some non-negligible time is wasted in jobs due to write-sync on containers, but the profiler's timeline only gives blue bars of total time.

    Can I find out the exact time wasted on waiting?
     
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    You should read through this.
    https://docs.unity3d.com/Packages/com.unity.entities@0.0/manual/job_component_system.html


    The job system is based on single writer principle. The idea being nothing is writing to the same containers in a way where synchronization is required. ParallelFor type jobs hand you an index into the native container in question so that only a single thread is writing to the same value. Or in the case of higher level jobs like IJobForEach it handles that level of detail for you.

    Sync points do show in the profiler as waiting for job group, wait for semaphore. If there are jobs not finished that it has to wait on.
     
    Abbrew likes this.