Do not record queue length in metrics on task dequeue.

It is more meaningful for the metrics to contain the queue length on enqueue tasks only.

PiperOrigin-RevId: 335682185
Change-Id: I40d2ed7555eb23bf8f62d7930186d6d0c49d275f
This commit is contained in:
Jing Dong 2020-10-06 11:26:05 -07:00 committed by TensorFlower Gardener
parent c5d4acd09a
commit 31029280a2

View File

@ -440,8 +440,7 @@ void ExecutorState<PropagatorStateType>::RunTask(Closure&& c) {
// mutable is needed because std::forward<Closure> in the lambda body may move
// the Closure `c`.
runner_([c = std::forward<Closure>(c)]() mutable {
auto qlen = queue_length.fetch_sub(1, std::memory_order_relaxed);
metrics::UpdateGraphPendingQueueLength(qlen - 1);
queue_length.fetch_sub(1, std::memory_order_relaxed);
std::forward<Closure>(c)();
});
}