コード例 #1
0
 /// <summary>
 /// Sets the max parallelism for the given queue
 /// </summary>
 public void SetMaxParallelDegreeByKind(DispatcherKind kind, int maxParallelDegree)
 {
     if (m_queuesByKind[kind].AdjustParallelDegree(maxParallelDegree) && maxParallelDegree > 0)
     {
         TriggerDispatcher();
     }
 }
コード例 #2
0
 internal void Dequeued()
 {
     if (m_currentQueue != DispatcherKind.None)
     {
         var duration = DateTime.UtcNow - m_queueEnterTime;
         QueueDurations.Value[(int)m_currentQueue] += duration;
         m_currentQueue = DispatcherKind.None;
     }
 }
コード例 #3
0
        /// <summary>
        /// Sets the max parallelism for the given queue
        /// </summary>
        public void SetMaxParallelDegreeByKind(DispatcherKind kind, int maxParallelDegree)
        {
            if (maxParallelDegree == 0)
            {
                // We only allow 0 for ChooseWorkerCpu and ChooseWorkerCacheLookup dispatchers.
                // For all other dispatchers, 0 is not allowed for potential deadlocks.
                if (!kind.IsChooseWorker())
                {
                    maxParallelDegree = 1;
                }
            }

            if (m_queuesByKind[kind].AdjustParallelDegree(maxParallelDegree) && maxParallelDegree > 0)
            {
                TriggerDispatcher();
            }
        }
コード例 #4
0
        internal void Dequeued(bool hasWaitedForMaterializeOutputsInBackground)
        {
            if (m_currentQueue != DispatcherKind.None)
            {
                var duration = DateTime.UtcNow - m_queueEnterTime;

                if (hasWaitedForMaterializeOutputsInBackground)
                {
                    QueueWaitDurationForMaterializeOutputsInBackground = duration;
                }
                else
                {
                    QueueDurations.Value[(int)m_currentQueue] += duration;
                }

                m_currentQueue = DispatcherKind.None;
            }
        }
コード例 #5
0
        protected ChooseWorkerContext(
            LoggingContext loggingContext,
            IReadOnlyList <Worker> workers,
            IPipQueue pipQueue,
            DispatcherKind kind,
            int maxParallelDegree)
        {
            Workers           = workers;
            PipQueue          = pipQueue;
            LocalWorker       = (LocalWorker)workers[0];
            LoggingContext    = loggingContext;
            Kind              = kind;
            MaxParallelDegree = maxParallelDegree;

            foreach (var worker in Workers)
            {
                worker.ResourcesChanged += OnWorkerResourcesChanged;
            }
        }
コード例 #6
0
 internal void Enqueued(DispatcherKind kind)
 {
     m_currentQueue   = kind;
     m_queueEnterTime = DateTime.UtcNow;
 }
コード例 #7
0
ファイル: TestPipQueue.cs プロジェクト: uilit/BuildXL
 /// <inheritdoc/>
 public int GetMaxParallelDegreeByKind(DispatcherKind queueKind) => m_innerQueue.GetMaxParallelDegreeByKind(queueKind);
コード例 #8
0
ファイル: TestPipQueue.cs プロジェクト: uilit/BuildXL
 /// <inheritdoc/>
 public void SetMaxParallelDegreeByKind(DispatcherKind queueKind, int maxParallelDegree) => m_innerQueue.SetMaxParallelDegreeByKind(queueKind, maxParallelDegree);
コード例 #9
0
ファイル: TestPipQueue.cs プロジェクト: uilit/BuildXL
 /// <inheritdoc/>
 public int GetNumQueuedByKind(DispatcherKind queueKind) => m_innerQueue.GetNumQueuedByKind(queueKind);
コード例 #10
0
        internal void UnpauseChooseWorkerQueueIfEnqueuingNewPip(RunnablePip runnablePip, DispatcherKind nextQueue)
        {
            // If enqueuing a new highest priority pip to queue
            if (nextQueue == DispatcherKind.ChooseWorkerCpu)
            {
                if (runnablePip != m_lastIterationBlockedPip)
                {
                    TogglePauseChooseWorkerQueue(pause: false);
                }

                // Capture the sequence number which will be used to compare if ChooseWorker queue is paused
                // waiting for resources for this pip to avoid race conditions where pip cannot acquire worker
                // resources become available then queue is paused potentially indefinitely (not likely but theoretically
                // possilbe)
                runnablePip.ChooseWorkerSequenceNumber = Volatile.Read(ref WorkerEnableSequenceNumber);
            }
        }
コード例 #11
0
 /// <inheritdoc/>
 public int GetMaxParallelDegreeByKind(DispatcherKind kind) => m_queuesByKind[kind].MaxParallelDegree;
コード例 #12
0
 /// <inheritdoc/>
 public int GetNumQueuedByKind(DispatcherKind kind) => m_queuesByKind[kind].NumQueued;
コード例 #13
0
 /// <inheritdoc/>
 public int GetNumRunningByKind(DispatcherKind kind) => m_queuesByKind[kind].NumRunning;
コード例 #14
0
 /// <inheritdoc/>
 public bool IsUseWeightByKind(DispatcherKind kind) => m_queuesByKind[kind].UseWeight;
コード例 #15
0
 /// <inheritdoc/>
 public int GetNumAcquiredSlotsByKind(DispatcherKind kind) => m_queuesByKind[kind].NumAcquiredSlots;
コード例 #16
0
ファイル: DispatcherKind.cs プロジェクト: microsoft/BuildXL
 /// <summary>
 /// Whether this dispatcher represents a logic for choosing a worker.
 /// </summary>
 public static bool IsChooseWorker(this DispatcherKind kind)
 {
     return(kind == DispatcherKind.ChooseWorkerLight || kind == DispatcherKind.ChooseWorkerCacheLookup || kind == DispatcherKind.ChooseWorkerCpu);
 }