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

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

Issue 719853003: Add source line info for JS Profiler ticks to debug protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/devtools/protocol.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/ScriptProfile.cpp
diff --git a/Source/core/inspector/ScriptProfile.cpp b/Source/core/inspector/ScriptProfile.cpp
index e835b01121c0b3a0674f58813e6f8bff186ba6a6..86c09ee6cfbf4ab5cace6e72c6bd6f5bc533b35e 100644
--- a/Source/core/inspector/ScriptProfile.cpp
+++ b/Source/core/inspector/ScriptProfile.cpp
@@ -64,6 +64,26 @@ double ScriptProfile::endTime() const
return static_cast<double>(m_profile->GetEndTime()) / 1000000;
}
+static RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::PositionTickInfo> > buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node)
+{
+ RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::PositionTickInfo> > array = TypeBuilder::Array<TypeBuilder::Profiler::PositionTickInfo>::create();
+ unsigned lineCount = node->GetHitLineCount();
+ if (!lineCount)
+ return array;
+
+ Vector<v8::CpuProfileNode::LineTick> entries(lineCount);
+ if (node->GetLineTicks(&entries[0], lineCount)) {
+ for (unsigned i = 0; i < lineCount; i++) {
+ RefPtr<TypeBuilder::Profiler::PositionTickInfo> line = TypeBuilder::Profiler::PositionTickInfo::create()
+ .setLine(entries[i].line)
+ .setTicks(entries[i].hit_count);
+ array->addItem(line);
+ }
+ }
+
+ return array;
+}
+
static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor(const v8::CpuProfileNode* node)
{
v8::HandleScope handleScope(v8::Isolate::GetCurrent());
@@ -75,6 +95,8 @@ static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor
children->addItem(buildInspectorObjectFor(child));
}
+ RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::PositionTickInfo> > positionTicks = buildInspectorObjectForPositionTicks(node);
+
RefPtr<TypeBuilder::Profiler::CPUProfileNode> result = TypeBuilder::Profiler::CPUProfileNode::create()
.setFunctionName(toCoreString(node->GetFunctionName()))
.setScriptId(String::number(node->GetScriptId()))
@@ -84,6 +106,7 @@ static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor
.setHitCount(node->GetHitCount())
.setCallUID(node->GetCallUid())
.setChildren(children.release())
+ .setPositionTicks(positionTicks.release())
.setDeoptReason(node->GetBailoutReason())
.setId(node->GetNodeId());
return result.release();
« no previous file with comments | « no previous file | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698