Commit 7f65ba38 authored by yurys@chromium.org's avatar yurys@chromium.org
Browse files

Web Inspector: update Timeline.TimelineEvent definition to include DOM...

Web Inspector: update Timeline.TimelineEvent definition to include DOM counters and native memory stats
https://bugs.webkit.org/show_bug.cgi?id=113376

Reviewed by Vsevolod Vlasov.

Added missing fields to Timeline.TimelineEvent type definition in Inspector.json

* inspector/Inspector.json:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
(WebCore::InspectorTimelineAgent::setDOMCounters):
Switched InspectorTimelineAgent to the new typed event builders.
(WebCore::InspectorTimelineAgent::setNativeHeapStatistics):
* inspector/InspectorTimelineAgent.h:
(InspectorTimelineAgent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146975 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3d818cc7
2013-03-27 Yury Semikhatsky <yurys@chromium.org>
Web Inspector: update Timeline.TimelineEvent definition to include DOM counters and native memory stats
https://bugs.webkit.org/show_bug.cgi?id=113376
Reviewed by Vsevolod Vlasov.
Added missing fields to Timeline.TimelineEvent type definition in Inspector.json
* inspector/Inspector.json:
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::innerAddRecordToTimeline):
(WebCore::InspectorTimelineAgent::setDOMCounters):
Switched InspectorTimelineAgent to the new typed event builders.
(WebCore::InspectorTimelineAgent::setNativeHeapStatistics):
* inspector/InspectorTimelineAgent.h:
(InspectorTimelineAgent):
2013-03-27 Vsevolod Vlasov <vsevik@chromium.org>
 
Web Inspector: Follow-up to r146898: test that uiSourceCodes are not leaking in breakpoint manager.
......@@ -2597,6 +2597,17 @@
"domain": "Timeline",
"description": "Timeline provides its clients with instrumentation records that are generated during the page runtime. Timeline instrumentation can be started and stopped using corresponding commands. While timeline is started, it is generating timeline event records.",
"types": [
{
"id": "DOMCounters",
"type": "object",
"properties": [
{ "name": "documents", "type": "integer" },
{ "name": "nodes", "type": "integer" },
{ "name": "jsEventListeners", "type": "integer" }
],
"description": "Current values of DOM counters.",
"hidden": true
},
{
"id": "TimelineEvent",
"type": "object",
......@@ -2604,7 +2615,10 @@
{ "name": "type", "type": "string", "description": "Event type." },
{ "name": "thread", "type": "string", "optional": true, "description": "If present, identifies the thread that produced the event.", "hidden": true },
{ "name": "data", "type": "object", "description": "Event data." },
{ "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." }
{ "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." },
{ "name": "counters", "$ref": "DOMCounters", "optional": true, "hidden": true, "description": "Current values of DOM counters." },
{ "name": "usedHeapSize", "type": "integer", "optional": true, "hidden": true, "description": "Current size of JS heap." },
{ "name": "nativeHeapStatistics", "type": "object", "optional": true, "hidden": true, "description": "Native heap statistics." }
],
"description": "Timeline record contains information about the recorded activity."
}
......
......@@ -540,7 +540,7 @@ void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> rec
void InspectorTimelineAgent::innerAddRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type)
{
RefPtr<InspectorObject> record(prpRecord);
RefPtr<TypeBuilder::Timeline::TimelineEvent> record = TypeBuilder::Timeline::TimelineEvent::runtimeCast(prpRecord);
record->setString("type", type);
if (type == TimelineRecordType::Program)
setNativeHeapStatistics(record.get());
......@@ -562,20 +562,27 @@ static size_t getUsedHeapSize()
return info.usedJSHeapSize;
}
void InspectorTimelineAgent::setDOMCounters(InspectorObject* record)
void InspectorTimelineAgent::setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record)
{
record->setNumber("usedHeapSize", getUsedHeapSize());
record->setUsedHeapSize(getUsedHeapSize());
if (m_state->getBoolean(TimelineAgentState::includeDomCounters)) {
RefPtr<InspectorObject> counters = InspectorObject::create();
counters->setNumber("nodes", (m_inspectorType == PageInspector) ? InspectorCounters::counterValue(InspectorCounters::NodeCounter) : 0);
counters->setNumber("documents", (m_inspectorType == PageInspector) ? InspectorCounters::counterValue(InspectorCounters::DocumentCounter) : 0);
counters->setNumber("jsEventListeners", ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter));
record->setObject("counters", counters.release());
int documentCount = 0;
int nodeCount = 0;
if (m_inspectorType == PageInspector) {
documentCount = InspectorCounters::counterValue(InspectorCounters::DocumentCounter);
nodeCount = InspectorCounters::counterValue(InspectorCounters::NodeCounter);
}
int listenerCount = ThreadLocalInspectorCounters::current().counterValue(ThreadLocalInspectorCounters::JSEventListenerCounter);
RefPtr<TypeBuilder::Timeline::DOMCounters> counters = TypeBuilder::Timeline::DOMCounters::create()
.setDocuments(documentCount)
.setNodes(nodeCount)
.setJsEventListeners(listenerCount);
record->setCounters(counters.release());
}
}
void InspectorTimelineAgent::setNativeHeapStatistics(InspectorObject* record)
void InspectorTimelineAgent::setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record)
{
if (!m_memoryAgent)
return;
......@@ -590,7 +597,7 @@ void InspectorTimelineAgent::setNativeHeapStatistics(InspectorObject* record)
size_t sharedBytes = 0;
MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes);
stats->setNumber("PrivateBytes", privateBytes);
record->setObject("nativeHeapStatistics", stats.release());
record->setNativeHeapStatistics(stats.release());
}
void InspectorTimelineAgent::setFrameIdentifier(InspectorObject* record, Frame* frame)
......
......@@ -214,8 +214,8 @@ private:
void appendRecord(PassRefPtr<InspectorObject> data, const String& type, bool captureCallStack, Frame*);
void pushCurrentRecord(PassRefPtr<InspectorObject>, const String& type, bool captureCallStack, Frame*, bool hasLowLevelDetails = false);
void setDOMCounters(InspectorObject* record);
void setNativeHeapStatistics(InspectorObject* record);
void setDOMCounters(TypeBuilder::Timeline::TimelineEvent* record);
void setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record);
void setFrameIdentifier(InspectorObject* record, Frame*);
void pushGCEventRecords();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment