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

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: Reverting the reverted container existance check. 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
Index: Source/core/inspector/TimelineTraceEventProcessor.cpp
diff --git a/Source/core/inspector/TimelineTraceEventProcessor.cpp b/Source/core/inspector/TimelineTraceEventProcessor.cpp
index 4554d1eae93789f0203ba5629f79eacc8fb9ced1..2b9689dafe2abad85c944e1d901d598b1cb26f81 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);
caseq 2013/11/05 14:26:58 How about s/Gpu/GPU/ globally on the patch?
alph 2013/11/05 14:59:16 I'd like to keep it as "Gpu" taking into account o
alph 2013/11/05 18:28:58 Done.
+ registerHandler(InstrumentationEvents::GpuTask, TRACE_EVENT_PHASE_END, &TimelineTraceEventProcessor::onGpuTaskEnd);
+ }
TraceEventDispatcher::instance()->addProcessor(this, m_inspectorClient);
}
@@ -417,6 +425,24 @@ void TimelineTraceEventProcessor::onLazyPixelRefDeleted(const TraceEvent& event)
m_pixelRefToImageInfo.remove(event.id());
}
+void TimelineTraceEventProcessor::onGpuTaskBegin(const TraceEvent& event)
+{
+ RefPtr<JSONObject> data = JSONObject::create();
+ data->setString("name", event.name());
caseq 2013/11/05 14:26:58 Do we really want to expose this?
alph 2013/11/05 14:59:16 not really. nuked.
+ data->setNumber("ownerPid", event.asUInt(InstrumentationEventArguments::OwnerPid));
caseq 2013/11/05 14:26:58 Please extract the above lines into a TimelineReco
alph 2013/11/05 14:59:16 The record creation is quite simple already. Also
alph 2013/11/05 18:28:58 Done.
+ m_gpuTask = createRecord(event, TimelineRecordType::GPUTask, data);
+}
+
+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());

Powered by Google App Engine
This is Rietveld 408576698