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

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

Issue 212893002: Use monotonicallyIncreasingTime for Timeline timestamps (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: scale to milliseconds Created 6 years, 9 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/core/inspector/InspectorTimelineAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorTimelineAgent.cpp
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index f3e3ef05d8dafc1406d62f277d6132bae62984d2..f32ae8e373c6ff8890506cb90444eb04f12c45a0 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -256,11 +256,6 @@ static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window,
return false;
}
-void TimelineTimeConverter::reset()
-{
- m_startOffset = monotonicallyIncreasingTime() - currentTime();
pfeldman 2014/03/27 13:26:57 I am not sure what this gives you. Either wall or
-}
-
void InspectorTimelineAgent::pushGCEventRecords()
{
if (!m_gcEvents.size())
@@ -269,8 +264,8 @@ void InspectorTimelineAgent::pushGCEventRecords()
GCEvents events = m_gcEvents;
m_gcEvents.clear();
for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) {
- RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(m_timeConverter.fromMonotonicallyIncreasingTime(i->startTime), m_maxCallStackDepth, TimelineRecordType::GCEvent, TimelineRecordFactory::createGCEventData(i->collectedBytes));
- record->setEndTime(m_timeConverter.fromMonotonicallyIncreasingTime(i->endTime));
+ RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(toTimelineTimestamp(i->startTime), m_maxCallStackDepth, TimelineRecordType::GCEvent, TimelineRecordFactory::createGCEventData(i->collectedBytes));
+ record->setEndTime(toTimelineTimestamp(i->endTime));
addRecordToTimeline(record.release());
}
}
@@ -364,7 +359,6 @@ void InspectorTimelineAgent::innerStart()
if (m_overlay)
m_overlay->startedRecordingProfile();
m_state->setBoolean(TimelineAgentState::started, true);
- m_timeConverter.reset();
m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this);
if (m_client) {
@@ -765,17 +759,12 @@ void InspectorTimelineAgent::didReceiveResourceResponse(LocalFrame* frame, unsig
void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime)
{
- appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFactory::requestId(identifier), didFail, finishTime * 1000), TimelineRecordType::ResourceFinish, false, 0);
+ appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFactory::requestId(identifier), didFail, finishTime), TimelineRecordType::ResourceFinish, false, 0);
}
void InspectorTimelineAgent::didFinishLoading(unsigned long identifier, DocumentLoader* loader, double monotonicFinishTime, int64_t)
{
- double finishTime = 0.0;
- // FIXME: Expose all of the timing details to inspector and have it calculate finishTime.
- if (monotonicFinishTime)
- finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFinishTime);
-
- didFinishLoadingResource(identifier, false, finishTime);
+ didFinishLoadingResource(identifier, false, toTimelineTimestamp(monotonicFinishTime));
}
void InspectorTimelineAgent::didFailLoading(unsigned long identifier, const ResourceError& error)
@@ -925,13 +914,13 @@ void InspectorTimelineAgent::onBeginImplSideFrame(const TraceEventDispatcher::Tr
void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::TraceEvent& event)
{
ASSERT(!m_paintSetupStart);
- m_paintSetupStart = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ m_paintSetupStart = toTimelineTimestamp(event.timestamp());
}
void InspectorTimelineAgent::onPaintSetupEnd(const TraceEventDispatcher::TraceEvent& event)
{
ASSERT(m_paintSetupStart);
- m_paintSetupEnd = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ m_paintSetupEnd = toTimelineTimestamp(event.timestamp());
}
void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::TraceEvent& event)
@@ -943,7 +932,7 @@ void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::Trace
return;
ASSERT(!state.inKnownLayerTask);
state.inKnownLayerTask = true;
- double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ double timestamp = toTimelineTimestamp(event.timestamp());
RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(m_layerToNodeMap.get(layerId));
RefPtr<TimelineEvent> record = TimelineRecordFactory::createBackgroundRecord(timestamp, String::number(event.threadIdentifier()), TimelineRecordType::Rasterize, data);
state.recordStack.addScopedRecord(record, TimelineRecordType::Rasterize);
@@ -955,7 +944,7 @@ void InspectorTimelineAgent::onRasterTaskEnd(const TraceEventDispatcher::TraceEv
if (!state.inKnownLayerTask)
return;
ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize));
- state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
+ state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp()));
state.inKnownLayerTask = false;
}
@@ -974,7 +963,7 @@ void InspectorTimelineAgent::onImageDecodeBegin(const TraceEventDispatcher::Trac
}
RefPtr<JSONObject> data = JSONObject::create();
TimelineRecordFactory::setImageDetails(data.get(), imageInfo.backendNodeId, imageInfo.url);
- double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ double timeestamp = toTimelineTimestamp(event.timestamp());
state.recordStack.addScopedRecord(TimelineRecordFactory::createBackgroundRecord(timeestamp, String::number(event.threadIdentifier()), TimelineRecordType::DecodeImage, data), TimelineRecordType::DecodeImage);
}
@@ -984,7 +973,7 @@ void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE
if (!state.decodedPixelRefId)
return;
ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage));
- state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
+ state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp()));
}
void InspectorTimelineAgent::onRequestMainThreadFrame(const TraceEventDispatcher::TraceEvent& event)
@@ -1056,7 +1045,7 @@ void InspectorTimelineAgent::onLazyPixelRefDeleted(const TraceEventDispatcher::T
void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event)
{
- double timelineTimestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp);
+ double timelineTimestamp = toTimelineTimestamp(event.timestamp);
if (event.phase == GPUEvent::PhaseBegin) {
m_pendingGPURecord = TimelineRecordFactory::createBackgroundRecord(timelineTimestamp, "gpu", TimelineRecordType::GPUTask, TimelineRecordFactory::createGPUTaskData(event.foreign));
} else if (m_pendingGPURecord) {
@@ -1073,7 +1062,7 @@ void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event)
void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher::TraceEvent& event)
{
TimelineThreadState& state = threadState(event.threadIdentifier());
- double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ double timestamp = toTimelineTimestamp(event.timestamp());
RefPtr<JSONObject> data = TimelineRecordFactory::createEmbedderCallbackData(event.asString(InstrumentationEventArguments::CallbackName));
RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(timestamp, 0, TimelineRecordType::EmbedderCallback, data);
state.recordStack.addScopedRecord(record, TimelineRecordType::EmbedderCallback);
@@ -1082,7 +1071,7 @@ void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher:
void InspectorTimelineAgent::onEmbedderCallbackEnd(const TraceEventDispatcher::TraceEvent& event)
{
TimelineThreadState& state = threadState(event.threadIdentifier());
- state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp()));
+ state.recordStack.closeScopedRecord(toTimelineTimestamp(event.timestamp()));
}
void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<TimelineEvent> record)
@@ -1282,9 +1271,14 @@ void InspectorTimelineAgent::releaseNodeIds()
m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup);
}
+double InspectorTimelineAgent::toTimelineTimestamp(double monotonicallyIncreasingTime)
pfeldman 2014/03/27 13:26:57 There is no "timeline timestamp", it is millis all
+{
+ return monotonicallyIncreasingTime * 1000.0;
+}
+
double InspectorTimelineAgent::timestamp()
{
- return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyIncreasingTime());
+ return toTimelineTimestamp(WTF::monotonicallyIncreasingTime());
}
FrameHost* InspectorTimelineAgent::frameHost() const
@@ -1296,7 +1290,7 @@ FrameHost* InspectorTimelineAgent::frameHost() const
PassRefPtr<TimelineEvent> InspectorTimelineAgent::createRecordForEvent(const TraceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data)
{
- double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.timestamp());
+ double timeestamp = toTimelineTimestamp(event.timestamp());
return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::number(event.threadIdentifier()), type, data);
}
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698