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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp

Issue 2262543002: DevTools: Profiler domain refactoring: encode timestamps as deltas. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
index a7df3142b2f32bd26d3fa15c7b4061625f2292d5..b124e97ffb53c56adab1bf8ebf0a37efbe0249f4 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp
@@ -83,12 +83,16 @@ std::unique_ptr<protocol::Array<int>> buildInspectorObjectForSamples(v8::CpuProf
return array;
}
-std::unique_ptr<protocol::Array<double>> buildInspectorObjectForTimestamps(v8::CpuProfile* v8profile)
+std::unique_ptr<protocol::Array<int>> buildInspectorObjectForTimestamps(v8::CpuProfile* v8profile)
{
- std::unique_ptr<protocol::Array<double>> array = protocol::Array<double>::create();
+ std::unique_ptr<protocol::Array<int>> array = protocol::Array<int>::create();
int count = v8profile->GetSamplesCount();
- for (int i = 0; i < count; i++)
- array->addItem(v8profile->GetSampleTimestamp(i));
+ uint64_t lastTime = v8profile->GetStartTime();
+ for (int i = 0; i < count; i++) {
+ uint64_t ts = v8profile->GetSampleTimestamp(i);
+ array->addItem(static_cast<int>(ts - lastTime));
+ lastTime = ts;
+ }
return array;
}
@@ -107,10 +111,10 @@ std::unique_ptr<protocol::Profiler::CPUProfile> createCPUProfile(v8::Isolate* is
std::unique_ptr<protocol::Profiler::CPUProfile> profile = protocol::Profiler::CPUProfile::create()
.setNodes(std::move(nodes))
- .setStartTime(static_cast<double>(v8profile->GetStartTime()) / 1000000)
- .setEndTime(static_cast<double>(v8profile->GetEndTime()) / 1000000).build();
+ .setStartTime(static_cast<double>(v8profile->GetStartTime()))
+ .setEndTime(static_cast<double>(v8profile->GetEndTime())).build();
profile->setSamples(buildInspectorObjectForSamples(v8profile));
- profile->setTimestamps(buildInspectorObjectForTimestamps(v8profile));
+ profile->setTimestampDeltas(buildInspectorObjectForTimestamps(v8profile));
return profile;
}

Powered by Google App Engine
This is Rietveld 408576698