Diff
Modified: trunk/LayoutTests/http/tests/inspector/inspector-test.js (110393 => 110394)
--- trunk/LayoutTests/http/tests/inspector/inspector-test.js 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/LayoutTests/http/tests/inspector/inspector-test.js 2012-03-11 16:35:35 UTC (rev 110394)
@@ -173,10 +173,10 @@
InspectorTest.addResult(prefixWithName + value);
}
-InspectorTest.assertGreaterOrEqual = function(expected, actual, message)
+InspectorTest.assertGreaterOrEqual = function(a, b, message)
{
- if (actual < expected)
- InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + actual + " < " + expected);
+ if (a < b)
+ InspectorTest.addResult("FAILED: " + (message ? message + ": " : "") + a + " < " + b);
}
InspectorTest.navigate = function(url, callback)
Modified: trunk/LayoutTests/http/tests/inspector/network/network-timing.html (110393 => 110394)
--- trunk/LayoutTests/http/tests/inspector/network/network-timing.html 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/LayoutTests/http/tests/inspector/network/network-timing.html 2012-03-11 16:35:35 UTC (rev 110394)
@@ -35,13 +35,13 @@
var resourcesCount = resources.length;
var resource1 = resources[resourcesCount - 2];
InspectorTest.addResult(resource1.url);
- InspectorTest.assertGreaterOrEqual(100, resource1.latency * 1000, "Latency of the first resource");
- InspectorTest.assertGreaterOrEqual(300, resource1.duration * 1000, "Duration of the first resource");
+ InspectorTest.assertGreaterOrEqual(resource1.latency * 1000, 100, "Latency of the first resource");
+ InspectorTest.assertGreaterOrEqual(resource1.duration * 1000, 300, "Duration of the first resource");
var resource2 = resources[resourcesCount - 1];
InspectorTest.addResult(resource2.url);
- InspectorTest.assertGreaterOrEqual(100, resource2.latency * 1000, "Latency of the second resource");
- InspectorTest.assertGreaterOrEqual(100, resource2.duration * 1000, "Duration of the second resource");
+ InspectorTest.assertGreaterOrEqual(resource2.latency * 1000, 100, "Latency of the second resource");
+ InspectorTest.assertGreaterOrEqual(resource2.duration * 1000, 100, "Duration of the second resource");
InspectorTest.completeTest();
}
}
Added: trunk/LayoutTests/inspector/timeline/timeline-start-time-expected.txt (0 => 110394)
--- trunk/LayoutTests/inspector/timeline/timeline-start-time-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-start-time-expected.txt 2012-03-11 16:35:35 UTC (rev 110394)
@@ -0,0 +1,4 @@
+Tests sanity of timeline timestamps.
+
+done
+
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-start-time-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/timeline/timeline-start-time.html (0 => 110394)
--- trunk/LayoutTests/inspector/timeline/timeline-start-time.html (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-start-time.html 2012-03-11 16:35:35 UTC (rev 110394)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function performActions()
+{
+ console.timeStamp("time is an illusion");
+}
+
+function test()
+{
+ var beforeStart = Date.now();
+ InspectorTest.startTimeline();
+ InspectorTest.waitForRecordType("TimeStamp", onTimeStamp);
+ InspectorTest.evaluateInPage("performActions()");
+
+ function onTimeStamp(record)
+ {
+ var now = Date.now();
+ var eventTime = record.startTime;
+ InspectorTest.assertGreaterOrEqual(eventTime, beforeStart, "event time should be after timeline start time");
+ InspectorTest.assertGreaterOrEqual(now, eventTime, "event time should be before now");
+ InspectorTest.addResult("done");
+ InspectorTest.stopTimeline(InspectorTest.completeTest.bind(InspectorTest));
+ }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests sanity of timeline timestamps.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-start-time.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (110393 => 110394)
--- trunk/Source/WebCore/ChangeLog 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/Source/WebCore/ChangeLog 2012-03-11 16:35:35 UTC (rev 110394)
@@ -1,3 +1,25 @@
+2012-03-11 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: use monotonically increasing time in timeline agent
+ https://bugs.webkit.org/show_bug.cgi?id=80786
+
+ Reviewed by Pavel Feldman.
+
+ * bindings/v8/ScriptGCEvent.cpp:
+ (WebCore::ScriptGCEvent::gcPrologueCallback):
+ (WebCore::ScriptGCEvent::gcEpilogueCallback):
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::pushGCEventRecords):
+ (WebCore::InspectorTimelineAgent::willSendResourceRequest):
+ (WebCore::InspectorTimelineAgent::didCompleteCurrentRecord):
+ (WebCore::InspectorTimelineAgent::appendRecord):
+ (WebCore::InspectorTimelineAgent::pushCurrentRecord):
+ (WebCore::InspectorTimelineAgent::timestamp):
+ (WebCore):
+ * inspector/InspectorTimelineAgent.h:
+ (InspectorTimelineAgent):
+ (WebCore::InspectorTimelineAgent::timestamp):
+
2012-03-11 Vsevolod Vlasov <[email protected]>
Web Inspector: Network panel does not show responses for application/json data
Modified: trunk/Source/WebCore/bindings/v8/ScriptGCEvent.cpp (110393 => 110394)
--- trunk/Source/WebCore/bindings/v8/ScriptGCEvent.cpp 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/Source/WebCore/bindings/v8/ScriptGCEvent.cpp 2012-03-11 16:35:35 UTC (rev 110394)
@@ -90,13 +90,13 @@
void ScriptGCEvent::gcPrologueCallback(v8::GCType type, v8::GCCallbackFlags flags)
{
- s_startTime = WTF::currentTimeMS();
+ s_startTime = WTF::monotonicallyIncreasingTime();
s_usedHeapSize = getUsedHeapSize();
}
void ScriptGCEvent::gcEpilogueCallback(v8::GCType type, v8::GCCallbackFlags flags)
{
- double endTime = WTF::currentTimeMS();
+ double endTime = WTF::monotonicallyIncreasingTime();
size_t collectedBytes = s_usedHeapSize - getUsedHeapSize();
GCEventListeners listeners(eventListeners());
for (GCEventListeners::iterator i = listeners.begin(); i != listeners.end(); ++i)
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (110393 => 110394)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2012-03-11 16:35:35 UTC (rev 110394)
@@ -100,9 +100,9 @@
GCEvents events = m_gcEvents;
m_gcEvents.clear();
for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) {
- RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(i->startTime, m_maxCallStackDepth);
+ RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestampFromMicroseconds(i->startTime), m_maxCallStackDepth);
record->setObject("data", TimelineRecordFactory::createGCEventData(i->collectedBytes));
- record->setNumber("endTime", i->endTime);
+ record->setNumber("endTime", timestampFromMicroseconds(i->endTime));
addRecordToTimeline(record.release(), TimelineRecordType::GCEvent);
}
}
@@ -148,7 +148,7 @@
else
m_maxCallStackDepth = 5;
m_state->setLong(TimelineAgentState::timelineMaxCallStackDepth, m_maxCallStackDepth);
-
+ m_timestampOffset = currentTime() - monotonicallyIncreasingTime();
m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this);
m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
@@ -299,7 +299,7 @@
void InspectorTimelineAgent::willSendResourceRequest(unsigned long identifier, const ResourceRequest& request)
{
pushGCEventRecords();
- RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), m_maxCallStackDepth);
+ RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), m_maxCallStackDepth);
String requestId = IdentifiersFactory::requestId(identifier);
record->setObject("data", TimelineRecordFactory::createResourceSendRequestData(requestId, request));
record->setString("type", TimelineRecordType::ResourceSendRequest);
@@ -416,7 +416,7 @@
ASSERT(entry.type == type);
entry.record->setObject("data", entry.data);
entry.record->setArray("children", entry.children);
- entry.record->setNumber("endTime", WTF::currentTimeMS());
+ entry.record->setNumber("endTime", timestamp());
addRecordToTimeline(entry.record, type);
}
}
@@ -433,7 +433,7 @@
void InspectorTimelineAgent::appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack)
{
pushGCEventRecords();
- RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), captureCallStack ? m_maxCallStackDepth : 0);
+ RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
record->setObject("data", data);
record->setString("type", type);
addRecordToTimeline(record.release(), type);
@@ -442,7 +442,7 @@
void InspectorTimelineAgent::pushCurrentRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack)
{
pushGCEventRecords();
- RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(WTF::currentTimeMS(), captureCallStack ? m_maxCallStackDepth : 0);
+ RefPtr<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
m_recordStack.append(TimelineRecordEntry(record.release(), data, InspectorArray::create(), type));
}
@@ -452,6 +452,16 @@
m_id++;
}
+double InspectorTimelineAgent::timestamp()
+{
+ return timestampFromMicroseconds(WTF::monotonicallyIncreasingTime());
+}
+
+double InspectorTimelineAgent::timestampFromMicroseconds(double microseconds)
+{
+ return (microseconds + m_timestampOffset) * 1000.0;
+}
+
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (110393 => 110394)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-03-11 15:09:17 UTC (rev 110393)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2012-03-11 16:35:35 UTC (rev 110394)
@@ -156,7 +156,11 @@
void pushGCEventRecords();
void clearRecordStack();
+ double timestamp();
+ double timestampFromMicroseconds(double microseconds);
+
InspectorFrontend::Timeline* m_frontend;
+ double m_timestampOffset;
Vector<TimelineRecordEntry> m_recordStack;