Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2252)

Unified Diff: Source/platform/scheduler/Scheduler.cpp

Issue 490913002: Adding flow traces for blink scheduler events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merge with master and disable mangle Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/scheduler/Scheduler.h ('k') | Source/platform/scheduler/TracedTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/scheduler/Scheduler.cpp
diff --git a/Source/platform/scheduler/Scheduler.cpp b/Source/platform/scheduler/Scheduler.cpp
index 2bc137db631436e2baf9dc3e6a7cca1b87c7e05d..1219609a301d8af5939b0ed3009aba28a90df1cf 100644
--- a/Source/platform/scheduler/Scheduler.cpp
+++ b/Source/platform/scheduler/Scheduler.cpp
@@ -11,8 +11,6 @@
#include "platform/TraceEvent.h"
#include "public/platform/Platform.h"
#include "wtf/MainThread.h"
-#include "wtf/ThreadingPrimitives.h"
-
namespace blink {
@@ -78,8 +76,8 @@ public:
class Scheduler::MainThreadPendingTaskRunner : public WebThread::Task {
public:
MainThreadPendingTaskRunner(
- const Scheduler::Task& task, const TraceLocation& location)
- : m_task(task, location)
+ const Scheduler::Task& task, const TraceLocation& location, const char* traceName)
+ : m_task(task, location, traceName)
{
ASSERT(Scheduler::shared());
}
@@ -95,7 +93,7 @@ public:
m_task.run();
}
- Scheduler::TracedTask m_task;
+ TracedTask m_task;
};
Scheduler* Scheduler::s_sharedScheduler = nullptr;
@@ -149,18 +147,24 @@ void Scheduler::scheduleIdleTask(const TraceLocation& location, const IdleTask&
m_mainThread->postTask(new MainThreadIdleTaskAdapter(idleTask, 0, location));
}
+void Scheduler::postHighPriorityTaskInternal(const TraceLocation& location, const Task& task, const char* traceName)
+{
+ Locker<Mutex> lock(m_pendingTasksMutex);
+
+ m_pendingHighPriorityTasks.append(TracedTask(task, location, traceName));
+ atomicIncrement(&m_highPriorityTaskCount);
+ maybePostMainThreadPendingHighPriorityTaskRunner();
+ TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "PendingHighPriorityTasks", m_highPriorityTaskCount);
+}
+
void Scheduler::postTask(const TraceLocation& location, const Task& task)
{
- m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location));
+ m_mainThread->postTask(new MainThreadPendingTaskRunner(task, location, "Scheduler::MainThreadTask"));
}
void Scheduler::postInputTask(const TraceLocation& location, const Task& task)
{
- Locker<Mutex> lock(m_pendingTasksMutex);
- m_pendingHighPriorityTasks.append(TracedTask(task, location));
- atomicIncrement(&m_highPriorityTaskCount);
- maybePostMainThreadPendingHighPriorityTaskRunner();
- TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "PendingHighPriorityTasks", m_highPriorityTaskCount);
+ postHighPriorityTaskInternal(location, task, "Scheduler::InputTask");
}
void Scheduler::didReceiveInputEvent()
@@ -170,11 +174,7 @@ void Scheduler::didReceiveInputEvent()
void Scheduler::postCompositorTask(const TraceLocation& location, const Task& task)
{
- Locker<Mutex> lock(m_pendingTasksMutex);
- m_pendingHighPriorityTasks.append(TracedTask(task, location));
- atomicIncrement(&m_highPriorityTaskCount);
- maybePostMainThreadPendingHighPriorityTaskRunner();
- TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "PendingHighPriorityTasks", m_highPriorityTaskCount);
+ postHighPriorityTaskInternal(location, task, "Scheduler::CompositorTask");
}
void Scheduler::maybePostMainThreadPendingHighPriorityTaskRunner()
@@ -331,12 +331,4 @@ void Scheduler::enterSchedulerPolicyLocked(SchedulerPolicy schedulerPolicy)
TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink.scheduler"), "SchedulerPolicy", schedulerPolicy);
}
-void Scheduler::TracedTask::run()
-{
- TRACE_EVENT2("blink", "TracedTask::run",
- "src_file", m_location.fileName(),
- "src_func", m_location.functionName());
- m_task();
-}
-
} // namespace blink
« no previous file with comments | « Source/platform/scheduler/Scheduler.h ('k') | Source/platform/scheduler/TracedTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698