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

Unified Diff: Source/core/inspector/TimelineTraceEventProcessor.cpp

Issue 46663010: DevTools: Show GPU utilization bar on timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tune PID to hue magic const Created 7 years, 1 month 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/core/inspector/TimelineTraceEventProcessor.h ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/TimelineTraceEventProcessor.cpp
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp
index 4554d1eae93789f0203ba5629f79eacc8fb9ced1..217f83955ce09eda17e03333e10d4fd44084f2cf 100644
--- a/Source/core/inspector/TimelineTraceEventProcessor.cpp
+++ b/Source/core/inspector/TimelineTraceEventProcessor.cpp
@@ -177,6 +177,14 @@ TimelineTraceEventProcessor::TimelineTraceEventProcessor(WeakPtr<InspectorTimeli
registerHandler(PlatformInstrumentation::ImageDecodeEvent, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onImageDecodeEnd);
registerHandler(PlatformInstrumentation::DrawLazyPixelRefEvent, TRACE_EVENT_PHASE_INSTANT, &TimelineTraceEventProcessor::onDrawLazyPixelRef);
registerHandler(PlatformInstrumentation::LazyPixelRef, TRACE_EVENT_PHASE_DELETE_OBJECT, &TimelineTraceEventProcessor::onLazyPixelRefDeleted);
+ if (m_timelineAgent.get()->isCollectingGPUEvents()) {
+ // FIXME: Instead of filtering GPU events here on the client side
+ // just don't enable collection in the GPU process.
+ // Make sure GPU process agent can handle both client types connected
+ // simultaneously: ones that need GPU events and ones that do not.
+ registerHandler(InstrumentationEvents::GPUTask, TRACE_EVENT_PHASE_BEGIN, &TimelineTraceEventProcessor::onGPUTaskBegin);
+ registerHandler(InstrumentationEvents::GPUTask, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onGPUTaskEnd);
+ }
TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient);
}
@@ -417,6 +425,23 @@ void TimelineTraceEventProcessor::onLazyPixelRefDeleted(const TraceEvent& event)
m_pixelRefToImageInfo.remove(event.id());
}
+void TimelineTraceEventProcessor::onGPUTaskBegin(const TraceEvent& event)
+{
+ RefPtr<JSONObject> data = JSONObject::create();
+ unsigned ownerPID = event.asUInt(InstrumentationEventArguments::OwnerPID);
+ m_gpuTask = createRecord(event, TimelineRecordType::GPUTask, TimelineRecordFactory::createGPUTaskData(ownerPID));
+}
+
+void TimelineTraceEventProcessor::onGPUTaskEnd(const TraceEvent& event)
+{
+ InspectorTimelineAgent* timelineAgent = m_timelineAgent.get();
+ if (!timelineAgent || !m_gpuTask)
+ return;
+ m_gpuTask->setNumber("endTime", m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
+ timelineAgent->sendEvent(m_gpuTask);
+ m_gpuTask.clear();
+}
+
PassRefPtr<JSONObject> TimelineTraceEventProcessor::createRecord(const TraceEvent& event, const String& recordType, PassRefPtr<JSONObject> data)
{
double startTime = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
« no previous file with comments | « Source/core/inspector/TimelineTraceEventProcessor.h ('k') | Source/devtools/front_end/Settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698