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

Unified Diff: src/profiler/profile-generator.cc

Issue 2425093002: [profiler] Update cpu profile tracing format. (Closed)
Patch Set: CpuProfile -> Profile Created 4 years, 2 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
« no previous file with comments | « no previous file | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profile-generator.cc
diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc
index a670729b794961da40ef3668a326cb11cf851f90..69a10282becbc21b057fe8f29da516a555e81905 100644
--- a/src/profiler/profile-generator.cc
+++ b/src/profiler/profile-generator.cc
@@ -412,7 +412,7 @@ CpuProfile::CpuProfile(CpuProfiler* profiler, const char* title,
value->SetDouble("startTime",
(start_time_ - base::TimeTicks()).InMicroseconds());
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
- "CpuProfile", this, "data", std::move(value));
+ "Profile", this, "data", std::move(value));
}
void CpuProfile::AddPath(base::TimeTicks timestamp,
@@ -466,22 +466,27 @@ void CpuProfile::StreamPendingTraceEvents() {
if (pending_nodes.empty() && !samples_.length()) return;
auto value = TracedValue::Create();
- if (!pending_nodes.empty()) {
- value->BeginArray("nodes");
- for (auto node : pending_nodes) {
- value->BeginDictionary();
- BuildNodeValue(node, value.get());
- value->EndDictionary();
+ if (!pending_nodes.empty() || streaming_next_sample_ != samples_.length()) {
+ value->BeginDictionary("cpuProfile");
+ if (!pending_nodes.empty()) {
+ value->BeginArray("nodes");
+ for (auto node : pending_nodes) {
+ value->BeginDictionary();
+ BuildNodeValue(node, value.get());
+ value->EndDictionary();
+ }
+ value->EndArray();
}
- value->EndArray();
+ if (streaming_next_sample_ != samples_.length()) {
+ value->BeginArray("samples");
+ for (int i = streaming_next_sample_; i < samples_.length(); ++i) {
+ value->AppendInteger(samples_[i]->id());
+ }
+ value->EndArray();
+ }
+ value->EndDictionary();
}
-
if (streaming_next_sample_ != samples_.length()) {
- value->BeginArray("samples");
- for (int i = streaming_next_sample_; i < samples_.length(); ++i) {
- value->AppendInteger(samples_[i]->id());
- }
- value->EndArray();
value->BeginArray("timeDeltas");
base::TimeTicks lastTimestamp =
streaming_next_sample_ ? timestamps_[streaming_next_sample_ - 1]
@@ -497,8 +502,7 @@ void CpuProfile::StreamPendingTraceEvents() {
}
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
- "CpuProfileChunk", this, "data",
- std::move(value));
+ "ProfileChunk", this, "data", std::move(value));
}
void CpuProfile::FinishProfile() {
@@ -507,8 +511,7 @@ void CpuProfile::FinishProfile() {
auto value = TracedValue::Create();
value->SetDouble("endTime", (end_time_ - base::TimeTicks()).InMicroseconds());
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
- "CpuProfileChunk", this, "data",
- std::move(value));
+ "ProfileChunk", this, "data", std::move(value));
}
void CpuProfile::Print() {
« no previous file with comments | « no previous file | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698