Version: 2020.2
언어: 한국어

설명

Use for the parallel flow continuation point.

All parallel flow instances are equivalent and connected to the same Begin or Next events that happened previously. An example of a flow start point is job scheduling. For instance, IJobParallelForExtensions.Schedule generates an implicit Begin Profiler flow event and IJobParallelFor.Execute generates an implicit ParallelNext event.

using System;
using System.Threading;
using Unity.Profiling;
using Unity.Profiling.LowLevel;
using Unity.Profiling.LowLevel.Unsafe;

public class Example { static readonly ProfilerMarker k_ScheduleParallelTasksMarker = new ProfilerMarker("Schedule Parallel Tasks"); static readonly ProfilerMarker k_ParallelTaskMarker = new ProfilerMarker("Parallel Task");

static void EmitFlowEventAndChainThread(uint flowId) { // Mark the next k_ParallelTaskMarker as a beginning of the flow ProfilerUnsafeUtility.FlowEvent(flowId, ProfilerFlowEventType.ParallelNext); using (k_ParallelTaskMarker.Auto()) { // Do work } }

static void ScheduleParallelTask() { using (k_ScheduleParallelTasksMarker.Auto()) { var flowId = ProfilerUnsafeUtility.CreateFlow(ProfilerUnsafeUtility.CategoryScripts); // Mark the parent k_ScheduleParallelTasksMarker as a beginning of the flow ProfilerUnsafeUtility.FlowEvent(flowId, ProfilerFlowEventType.Begin); var thread = new Thread(() => EmitFlowEventAndChainThread(flowId)); thread.Start(); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961