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

Side by Side Diff: Source/core/inspector/InspectorTimelineAgent.cpp

Issue 212893002: Use monotonicallyIncreasingTime for Timeline timestamps (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed a test, it's not applicable now Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/loader/DocumentLoader.h" 53 #include "core/loader/DocumentLoader.h"
54 #include "core/page/Page.h" 54 #include "core/page/Page.h"
55 #include "core/rendering/RenderObject.h" 55 #include "core/rendering/RenderObject.h"
56 #include "core/rendering/RenderView.h" 56 #include "core/rendering/RenderView.h"
57 #include "core/xml/XMLHttpRequest.h" 57 #include "core/xml/XMLHttpRequest.h"
58 #include "platform/TraceEvent.h" 58 #include "platform/TraceEvent.h"
59 #include "platform/graphics/DeferredImageDecoder.h" 59 #include "platform/graphics/DeferredImageDecoder.h"
60 #include "platform/graphics/GraphicsLayer.h" 60 #include "platform/graphics/GraphicsLayer.h"
61 #include "platform/network/ResourceRequest.h" 61 #include "platform/network/ResourceRequest.h"
62 #include "wtf/CurrentTime.h" 62 #include "wtf/CurrentTime.h"
63 #include "wtf/DateMath.h"
63 64
64 namespace WebCore { 65 namespace WebCore {
65 66
66 namespace TimelineAgentState { 67 namespace TimelineAgentState {
67 static const char enabled[] = "enabled"; 68 static const char enabled[] = "enabled";
68 static const char started[] = "started"; 69 static const char started[] = "started";
69 static const char startedFromProtocol[] = "startedFromProtocol"; 70 static const char startedFromProtocol[] = "startedFromProtocol";
70 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth"; 71 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth";
71 static const char includeCounters[] = "includeCounters"; 72 static const char includeCounters[] = "includeCounters";
72 static const char includeGPUEvents[] = "includeGPUEvents"; 73 static const char includeGPUEvents[] = "includeGPUEvents";
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return true; 251 return true;
251 252
252 for (size_t i = 0; i < eventPath.size(); i++) { 253 for (size_t i = 0; i < eventPath.size(); i++) {
253 if (eventPath[i].node()->hasEventListeners(eventType)) 254 if (eventPath[i].node()->hasEventListeners(eventType))
254 return true; 255 return true;
255 } 256 }
256 257
257 return false; 258 return false;
258 } 259 }
259 260
260 void TimelineTimeConverter::reset()
261 {
262 m_startOffset = monotonicallyIncreasingTime() - currentTime();
263 }
264
265 void InspectorTimelineAgent::pushGCEventRecords() 261 void InspectorTimelineAgent::pushGCEventRecords()
266 { 262 {
267 if (!m_gcEvents.size()) 263 if (!m_gcEvents.size())
268 return; 264 return;
269 265
270 GCEvents events = m_gcEvents; 266 GCEvents events = m_gcEvents;
271 m_gcEvents.clear(); 267 m_gcEvents.clear();
272 for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) { 268 for (GCEvents::iterator i = events.begin(); i != events.end(); ++i) {
273 double ts = m_timeConverter.fromMonotonicallyIncreasingTime(i->startTime ); 269 double ts = i->startTime * msPerSecond;
274 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecor d(ts, m_maxCallStackDepth, TimelineRecordType::GCEvent, TimelineRecordFactory::c reateGCEventData(i->collectedBytes)); 270 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecor d(ts, m_maxCallStackDepth, TimelineRecordType::GCEvent, TimelineRecordFactory::c reateGCEventData(i->collectedBytes));
275 record->setEndTime(m_timeConverter.fromMonotonicallyIncreasingTime(i->en dTime)); 271 record->setEndTime(i->endTime * msPerSecond);
276 addRecordToTimeline(record.release(), ts); 272 addRecordToTimeline(record.release(), ts);
277 } 273 }
278 } 274 }
279 275
280 void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t coll ectedBytesCount) 276 void InspectorTimelineAgent::didGC(double startTime, double endTime, size_t coll ectedBytesCount)
281 { 277 {
282 m_gcEvents.append(TimelineGCEvent(startTime, endTime, collectedBytesCount)); 278 m_gcEvents.append(TimelineGCEvent(startTime, endTime, collectedBytesCount));
283 } 279 }
284 280
285 InspectorTimelineAgent::~InspectorTimelineAgent() 281 InspectorTimelineAgent::~InspectorTimelineAgent()
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 bool InspectorTimelineAgent::isStarted() 363 bool InspectorTimelineAgent::isStarted()
368 { 364 {
369 return m_state->getBoolean(TimelineAgentState::started); 365 return m_state->getBoolean(TimelineAgentState::started);
370 } 366 }
371 367
372 void InspectorTimelineAgent::innerStart() 368 void InspectorTimelineAgent::innerStart()
373 { 369 {
374 if (m_overlay) 370 if (m_overlay)
375 m_overlay->startedRecordingProfile(); 371 m_overlay->startedRecordingProfile();
376 m_state->setBoolean(TimelineAgentState::started, true); 372 m_state->setBoolean(TimelineAgentState::started, true);
377 m_timeConverter.reset();
378 m_instrumentingAgents->setInspectorTimelineAgent(this); 373 m_instrumentingAgents->setInspectorTimelineAgent(this);
379 ScriptGCEvent::addEventListener(this); 374 ScriptGCEvent::addEventListener(this);
380 if (m_client) { 375 if (m_client) {
381 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance(); 376 TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance();
382 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client); 377 dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_P HASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client);
383 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client); 378 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onPaintSetupBegin, m_client);
384 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client); 379 dispatcher->addListener(InstrumentationEvents::PaintSetup, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onPaintSetupEnd, m_client);
385 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client); 380 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_BEGIN, this, &InspectorTimelineAgent::onRasterTaskBegin, m_client);
386 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client); 381 dispatcher->addListener(InstrumentationEvents::RasterTask, TRACE_EVENT_P HASE_END, this, &InspectorTimelineAgent::onRasterTaskEnd, m_client);
387 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client); 382 dispatcher->addListener(InstrumentationEvents::Layer, TRACE_EVENT_PHASE_ DELETE_OBJECT, this, &InspectorTimelineAgent::onLayerDeleted, m_client);
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 765 }
771 766
772 void InspectorTimelineAgent::didReceiveResourceResponse(LocalFrame* frame, unsig ned long identifier, DocumentLoader* loader, const ResourceResponse& response, R esourceLoader* resourceLoader) 767 void InspectorTimelineAgent::didReceiveResourceResponse(LocalFrame* frame, unsig ned long identifier, DocumentLoader* loader, const ResourceResponse& response, R esourceLoader* resourceLoader)
773 { 768 {
774 String requestId = IdentifiersFactory::requestId(identifier); 769 String requestId = IdentifiersFactory::requestId(identifier);
775 appendRecord(TimelineRecordFactory::createResourceReceiveResponseData(reques tId, response), TimelineRecordType::ResourceReceiveResponse, false, 0); 770 appendRecord(TimelineRecordFactory::createResourceReceiveResponseData(reques tId, response), TimelineRecordType::ResourceReceiveResponse, false, 0);
776 } 771 }
777 772
778 void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime) 773 void InspectorTimelineAgent::didFinishLoadingResource(unsigned long identifier, bool didFail, double finishTime)
779 { 774 {
780 appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFact ory::requestId(identifier), didFail, finishTime * 1000), TimelineRecordType::Res ourceFinish, false, 0); 775 appendRecord(TimelineRecordFactory::createResourceFinishData(IdentifiersFact ory::requestId(identifier), didFail, finishTime), TimelineRecordType::ResourceFi nish, false, 0);
781 } 776 }
782 777
783 void InspectorTimelineAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime, int64_t) 778 void InspectorTimelineAgent::didFinishLoading(unsigned long identifier, Document Loader* loader, double monotonicFinishTime, int64_t)
784 { 779 {
785 double finishTime = 0.0; 780 didFinishLoadingResource(identifier, false, monotonicFinishTime * msPerSecon d);
786 // FIXME: Expose all of the timing details to inspector and have it calculat e finishTime.
787 if (monotonicFinishTime)
788 finishTime = loader->timing()->monotonicTimeToPseudoWallTime(monotonicFi nishTime);
789
790 didFinishLoadingResource(identifier, false, finishTime);
791 } 781 }
792 782
793 void InspectorTimelineAgent::didFailLoading(unsigned long identifier, const Reso urceError& error) 783 void InspectorTimelineAgent::didFailLoading(unsigned long identifier, const Reso urceError& error)
794 { 784 {
795 didFinishLoadingResource(identifier, true, 0); 785 didFinishLoadingResource(identifier, true, 0);
796 } 786 }
797 787
798 void InspectorTimelineAgent::consoleTimeStamp(ExecutionContext* context, const S tring& title) 788 void InspectorTimelineAgent::consoleTimeStamp(ExecutionContext* context, const S tring& title)
799 { 789 {
800 appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineReco rdType::TimeStamp, true, frameForExecutionContext(context)); 790 appendRecord(TimelineRecordFactory::createTimeStampData(title), TimelineReco rdType::TimeStamp, true, frameForExecutionContext(context));
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); 920 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId);
931 if (layerTreeId != m_layerTreeId) 921 if (layerTreeId != m_layerTreeId)
932 return; 922 return;
933 TimelineThreadState& state = threadState(event.threadIdentifier()); 923 TimelineThreadState& state = threadState(event.threadIdentifier());
934 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::BeginFrame, JSONObject::create())); 924 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::BeginFrame, JSONObject::create()));
935 } 925 }
936 926
937 void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::Trace Event& event) 927 void InspectorTimelineAgent::onPaintSetupBegin(const TraceEventDispatcher::Trace Event& event)
938 { 928 {
939 ASSERT(!m_paintSetupStart); 929 ASSERT(!m_paintSetupStart);
940 m_paintSetupStart = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); 930 m_paintSetupStart = event.timestamp() * msPerSecond;
941 } 931 }
942 932
943 void InspectorTimelineAgent::onPaintSetupEnd(const TraceEventDispatcher::TraceEv ent& event) 933 void InspectorTimelineAgent::onPaintSetupEnd(const TraceEventDispatcher::TraceEv ent& event)
944 { 934 {
945 ASSERT(m_paintSetupStart); 935 ASSERT(m_paintSetupStart);
946 m_paintSetupEnd = m_timeConverter.fromMonotonicallyIncreasingTime(event.time stamp()); 936 m_paintSetupEnd = event.timestamp() * msPerSecond;
947 } 937 }
948 938
949 void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::Trace Event& event) 939 void InspectorTimelineAgent::onRasterTaskBegin(const TraceEventDispatcher::Trace Event& event)
950 { 940 {
951 TimelineThreadState& state = threadState(event.threadIdentifier()); 941 TimelineThreadState& state = threadState(event.threadIdentifier());
952 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId); 942 unsigned long long layerId = event.asUInt(InstrumentationEventArguments::Lay erId);
953 ASSERT(layerId); 943 ASSERT(layerId);
954 if (!m_layerToNodeMap.contains(layerId)) 944 if (!m_layerToNodeMap.contains(layerId))
955 return; 945 return;
956 ASSERT(!state.inKnownLayerTask); 946 ASSERT(!state.inKnownLayerTask);
957 state.inKnownLayerTask = true; 947 state.inKnownLayerTask = true;
958 double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); 948 double timestamp = event.timestamp() * msPerSecond;
959 RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(m_layerToNo deMap.get(layerId)); 949 RefPtr<JSONObject> data = TimelineRecordFactory::createLayerData(m_layerToNo deMap.get(layerId));
960 RefPtr<TimelineEvent> record = TimelineRecordFactory::createBackgroundRecord (timestamp, String::number(event.threadIdentifier()), TimelineRecordType::Raster ize, data); 950 RefPtr<TimelineEvent> record = TimelineRecordFactory::createBackgroundRecord (timestamp, String::number(event.threadIdentifier()), TimelineRecordType::Raster ize, data);
961 state.recordStack.addScopedRecord(record, TimelineRecordType::Rasterize); 951 state.recordStack.addScopedRecord(record, TimelineRecordType::Rasterize);
962 } 952 }
963 953
964 void InspectorTimelineAgent::onRasterTaskEnd(const TraceEventDispatcher::TraceEv ent& event) 954 void InspectorTimelineAgent::onRasterTaskEnd(const TraceEventDispatcher::TraceEv ent& event)
965 { 955 {
966 TimelineThreadState& state = threadState(event.threadIdentifier()); 956 TimelineThreadState& state = threadState(event.threadIdentifier());
967 if (!state.inKnownLayerTask) 957 if (!state.inKnownLayerTask)
968 return; 958 return;
969 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize)); 959 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::Rasterize));
970 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); 960 state.recordStack.closeScopedRecord(event.timestamp() * msPerSecond);
971 state.inKnownLayerTask = false; 961 state.inKnownLayerTask = false;
972 } 962 }
973 963
974 void InspectorTimelineAgent::onImageDecodeBegin(const TraceEventDispatcher::Trac eEvent& event) 964 void InspectorTimelineAgent::onImageDecodeBegin(const TraceEventDispatcher::Trac eEvent& event)
975 { 965 {
976 TimelineThreadState& state = threadState(event.threadIdentifier()); 966 TimelineThreadState& state = threadState(event.threadIdentifier());
977 if (!state.decodedPixelRefId && !state.inKnownLayerTask) 967 if (!state.decodedPixelRefId && !state.inKnownLayerTask)
978 return; 968 return;
979 TimelineImageInfo imageInfo; 969 TimelineImageInfo imageInfo;
980 if (state.decodedPixelRefId) { 970 if (state.decodedPixelRefId) {
981 PixelRefToImageInfoMap::const_iterator it = m_pixelRefToImageInfo.find(s tate.decodedPixelRefId); 971 PixelRefToImageInfoMap::const_iterator it = m_pixelRefToImageInfo.find(s tate.decodedPixelRefId);
982 if (it != m_pixelRefToImageInfo.end()) 972 if (it != m_pixelRefToImageInfo.end())
983 imageInfo = it->value; 973 imageInfo = it->value;
984 else 974 else
985 ASSERT_NOT_REACHED(); 975 ASSERT_NOT_REACHED();
986 } 976 }
987 RefPtr<JSONObject> data = JSONObject::create(); 977 RefPtr<JSONObject> data = JSONObject::create();
988 TimelineRecordFactory::setImageDetails(data.get(), imageInfo.backendNodeId, imageInfo.url); 978 TimelineRecordFactory::setImageDetails(data.get(), imageInfo.backendNodeId, imageInfo.url);
989 double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); 979 double timeestamp = event.timestamp() * msPerSecond;
990 state.recordStack.addScopedRecord(TimelineRecordFactory::createBackgroundRec ord(timeestamp, String::number(event.threadIdentifier()), TimelineRecordType::De codeImage, data), TimelineRecordType::DecodeImage); 980 state.recordStack.addScopedRecord(TimelineRecordFactory::createBackgroundRec ord(timeestamp, String::number(event.threadIdentifier()), TimelineRecordType::De codeImage, data), TimelineRecordType::DecodeImage);
991 } 981 }
992 982
993 void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE vent& event) 983 void InspectorTimelineAgent::onImageDecodeEnd(const TraceEventDispatcher::TraceE vent& event)
994 { 984 {
995 TimelineThreadState& state = threadState(event.threadIdentifier()); 985 TimelineThreadState& state = threadState(event.threadIdentifier());
996 if (!state.decodedPixelRefId) 986 if (!state.decodedPixelRefId)
997 return; 987 return;
998 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) ); 988 ASSERT(state.recordStack.isOpenRecordOfType(TimelineRecordType::DecodeImage) );
999 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); 989 state.recordStack.closeScopedRecord(event.timestamp() * msPerSecond);
1000 } 990 }
1001 991
1002 void InspectorTimelineAgent::onRequestMainThreadFrame(const TraceEventDispatcher ::TraceEvent& event) 992 void InspectorTimelineAgent::onRequestMainThreadFrame(const TraceEventDispatcher ::TraceEvent& event)
1003 { 993 {
1004 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId); 994 unsigned long long layerTreeId = event.asUInt(InstrumentationEventArguments: :LayerTreeId);
1005 if (layerTreeId != m_layerTreeId) 995 if (layerTreeId != m_layerTreeId)
1006 return; 996 return;
1007 TimelineThreadState& state = threadState(event.threadIdentifier()); 997 TimelineThreadState& state = threadState(event.threadIdentifier());
1008 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::RequestMainThreadFrame, JSONObject::create())); 998 state.recordStack.addInstantRecord(createRecordForEvent(event, TimelineRecor dType::RequestMainThreadFrame, JSONObject::create()));
1009 } 999 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 m_pixelRefToImageInfo.set(pixelRefId, TimelineImageInfo(nodeId(m_imageBeingP ainted->generatingNode()), url)); 1051 m_pixelRefToImageInfo.set(pixelRefId, TimelineImageInfo(nodeId(m_imageBeingP ainted->generatingNode()), url));
1062 } 1052 }
1063 1053
1064 void InspectorTimelineAgent::onLazyPixelRefDeleted(const TraceEventDispatcher::T raceEvent& event) 1054 void InspectorTimelineAgent::onLazyPixelRefDeleted(const TraceEventDispatcher::T raceEvent& event)
1065 { 1055 {
1066 m_pixelRefToImageInfo.remove(event.id()); 1056 m_pixelRefToImageInfo.remove(event.id());
1067 } 1057 }
1068 1058
1069 void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event) 1059 void InspectorTimelineAgent::processGPUEvent(const GPUEvent& event)
1070 { 1060 {
1071 double timelineTimestamp = m_timeConverter.fromMonotonicallyIncreasingTime(e vent.timestamp); 1061 double timelineTimestamp = event.timestamp * msPerSecond;
1072 if (event.phase == GPUEvent::PhaseBegin) { 1062 if (event.phase == GPUEvent::PhaseBegin) {
1073 m_pendingGPURecord = TimelineRecordFactory::createBackgroundRecord(timel ineTimestamp, "gpu", TimelineRecordType::GPUTask, TimelineRecordFactory::createG PUTaskData(event.foreign)); 1063 m_pendingGPURecord = TimelineRecordFactory::createBackgroundRecord(timel ineTimestamp, "gpu", TimelineRecordType::GPUTask, TimelineRecordFactory::createG PUTaskData(event.foreign));
1074 } else if (m_pendingGPURecord) { 1064 } else if (m_pendingGPURecord) {
1075 m_pendingGPURecord->setEndTime(timelineTimestamp); 1065 m_pendingGPURecord->setEndTime(timelineTimestamp);
1076 if (!event.foreign && m_state->getBoolean(TimelineAgentState::includeCou nters)) { 1066 if (!event.foreign && m_state->getBoolean(TimelineAgentState::includeCou nters)) {
1077 RefPtr<TypeBuilder::Timeline::Counters> counters = TypeBuilder::Time line::Counters::create(); 1067 RefPtr<TypeBuilder::Timeline::Counters> counters = TypeBuilder::Time line::Counters::create();
1078 counters->setGpuMemoryUsedKB(static_cast<double>(event.usedGPUMemory Bytes / 1024)); 1068 counters->setGpuMemoryUsedKB(static_cast<double>(event.usedGPUMemory Bytes / 1024));
1079 m_pendingGPURecord->setCounters(counters.release()); 1069 m_pendingGPURecord->setCounters(counters.release());
1080 } 1070 }
1081 sendEvent(m_pendingGPURecord.release()); 1071 sendEvent(m_pendingGPURecord.release());
1082 } 1072 }
1083 } 1073 }
1084 1074
1085 void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher: :TraceEvent& event) 1075 void InspectorTimelineAgent::onEmbedderCallbackBegin(const TraceEventDispatcher: :TraceEvent& event)
1086 { 1076 {
1087 TimelineThreadState& state = threadState(event.threadIdentifier()); 1077 TimelineThreadState& state = threadState(event.threadIdentifier());
1088 double timestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.tim estamp()); 1078 double timestamp = event.timestamp() * msPerSecond;
1089 RefPtr<JSONObject> data = TimelineRecordFactory::createEmbedderCallbackData( event.asString(InstrumentationEventArguments::CallbackName)); 1079 RefPtr<JSONObject> data = TimelineRecordFactory::createEmbedderCallbackData( event.asString(InstrumentationEventArguments::CallbackName));
1090 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ti mestamp, 0, TimelineRecordType::EmbedderCallback, data); 1080 RefPtr<TimelineEvent> record = TimelineRecordFactory::createGenericRecord(ti mestamp, 0, TimelineRecordType::EmbedderCallback, data);
1091 state.recordStack.addScopedRecord(record, TimelineRecordType::EmbedderCallba ck); 1081 state.recordStack.addScopedRecord(record, TimelineRecordType::EmbedderCallba ck);
1092 } 1082 }
1093 1083
1094 void InspectorTimelineAgent::onEmbedderCallbackEnd(const TraceEventDispatcher::T raceEvent& event) 1084 void InspectorTimelineAgent::onEmbedderCallbackEnd(const TraceEventDispatcher::T raceEvent& event)
1095 { 1085 {
1096 TimelineThreadState& state = threadState(event.threadIdentifier()); 1086 TimelineThreadState& state = threadState(event.threadIdentifier());
1097 state.recordStack.closeScopedRecord(m_timeConverter.fromMonotonicallyIncreas ingTime(event.timestamp())); 1087 state.recordStack.closeScopedRecord(event.timestamp() * msPerSecond);
1098 } 1088 }
1099 1089
1100 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<TimelineEvent> recor d, double ts) 1090 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<TimelineEvent> recor d, double ts)
1101 { 1091 {
1102 commitFrameRecord(); 1092 commitFrameRecord();
1103 innerAddRecordToTimeline(record); 1093 innerAddRecordToTimeline(record);
1104 if (m_bufferedEvents && ts - m_lastProgressTimestamp > 300) { 1094 if (m_bufferedEvents && ts - m_lastProgressTimestamp > 300) {
1105 m_lastProgressTimestamp = ts; 1095 m_lastProgressTimestamp = ts;
1106 m_frontend->progress(m_bufferedEvents->length()); 1096 m_frontend->progress(m_bufferedEvents->length());
1107 } 1097 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1289
1300 void InspectorTimelineAgent::releaseNodeIds() 1290 void InspectorTimelineAgent::releaseNodeIds()
1301 { 1291 {
1302 ErrorString unused; 1292 ErrorString unused;
1303 if (m_domAgent) 1293 if (m_domAgent)
1304 m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup); 1294 m_domAgent->releaseBackendNodeIds(&unused, BackendNodeIdGroup);
1305 } 1295 }
1306 1296
1307 double InspectorTimelineAgent::timestamp() 1297 double InspectorTimelineAgent::timestamp()
1308 { 1298 {
1309 return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyInc reasingTime()); 1299 return WTF::monotonicallyIncreasingTime() * msPerSecond;
1310 } 1300 }
1311 1301
1312 FrameHost* InspectorTimelineAgent::frameHost() const 1302 FrameHost* InspectorTimelineAgent::frameHost() const
1313 { 1303 {
1314 if (!m_pageAgent || !m_pageAgent->page()) 1304 if (!m_pageAgent || !m_pageAgent->page())
1315 return 0; 1305 return 0;
1316 return &m_pageAgent->page()->frameHost(); 1306 return &m_pageAgent->page()->frameHost();
1317 } 1307 }
1318 1308
1319 PassRefPtr<TimelineEvent> InspectorTimelineAgent::createRecordForEvent(const Tra ceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data) 1309 PassRefPtr<TimelineEvent> InspectorTimelineAgent::createRecordForEvent(const Tra ceEventDispatcher::TraceEvent& event, const String& type, PassRefPtr<JSONObject> data)
1320 { 1310 {
1321 double timeestamp = m_timeConverter.fromMonotonicallyIncreasingTime(event.ti mestamp()); 1311 double timeestamp = event.timestamp() * msPerSecond;
1322 return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::num ber(event.threadIdentifier()), type, data); 1312 return TimelineRecordFactory::createBackgroundRecord(timeestamp, String::num ber(event.threadIdentifier()), type, data);
1323 } 1313 }
1324 1314
1325 void InspectorTimelineAgent::setLiveEvents(const String& liveEvents) 1315 void InspectorTimelineAgent::setLiveEvents(const String& liveEvents)
1326 { 1316 {
1327 m_liveEvents.clear(); 1317 m_liveEvents.clear();
1328 if (liveEvents.isNull() || liveEvents.isEmpty()) 1318 if (liveEvents.isNull() || liveEvents.isEmpty())
1329 return; 1319 return;
1330 Vector<String> eventList; 1320 Vector<String> eventList;
1331 liveEvents.split(",", eventList); 1321 liveEvents.split(",", eventList);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1355
1366 #ifndef NDEBUG 1356 #ifndef NDEBUG
1367 bool TimelineRecordStack::isOpenRecordOfType(const String& type) 1357 bool TimelineRecordStack::isOpenRecordOfType(const String& type)
1368 { 1358 {
1369 return !m_stack.isEmpty() && m_stack.last().type == type; 1359 return !m_stack.isEmpty() && m_stack.last().type == type;
1370 } 1360 }
1371 #endif 1361 #endif
1372 1362
1373 } // namespace WebCore 1363 } // namespace WebCore
1374 1364
OLDNEW
« 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