Bug 1807015 - Do not call Timestamp::Now when profiler is not running for event delay data r=nika,mstange

Differential Revision: https://phabricator.services.mozilla.com/D166950
This commit is contained in:
Nazım Can Altınova 2023-02-14 09:46:18 +00:00
Родитель b1c227d6c4
Коммит 0cf1198037
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -409,7 +409,9 @@ void TaskController::AddTask(already_AddRefed<Task>&& aTask) {
task->mPriorityModifier = manager->mCurrentPriorityModifier;
}
task->mInsertionTime = TimeStamp::Now();
if (profiler_is_active_and_unpaused()) {
task->mInsertionTime = TimeStamp::Now();
}
#ifdef DEBUG
task->mIsInGraph = true;
@ -834,7 +836,8 @@ bool TaskController::DoExecuteNextTaskOnlyMainThreadInternal(
TimeStamp now = TimeStamp::Now();
if (mainThread) {
if (task->GetPriority() < uint32_t(EventQueuePriority::InputHigh)) {
if (task->GetPriority() < uint32_t(EventQueuePriority::InputHigh) ||
task->mInsertionTime.IsNull()) {
mainThread->SetRunningEventDelay(TimeDuration(), now);
} else {
mainThread->SetRunningEventDelay(now - task->mInsertionTime, now);

Просмотреть файл

@ -331,9 +331,12 @@ nsThreadPool::Run() {
// to run.
DelayForChaosMode(ChaosFeature::TaskRunning, 1000);
// We'll handle the case of unstarted threads available
// when we sample.
current->SetRunningEventDelay(delay, TimeStamp::Now());
if (profiler_thread_is_being_profiled(
ThreadProfilingFeatures::Sampling)) {
// We'll handle the case of unstarted threads available
// when we sample.
current->SetRunningEventDelay(delay, TimeStamp::Now());
}
LogRunnable::Run log(event);
AUTO_PROFILE_FOLLOWING_RUNNABLE(event);