Commit b659cc1e authored by machenbach's avatar machenbach Committed by Commit bot

Revert of [profiler] Update cpu profile tracing format. (patchset #2 id:20001...

Revert of [profiler] Update cpu profile tracing format. (patchset #2 id:20001 of https://chromiumcodereview.appspot.com/2425093002/ )

Reason for revert:
Breaks
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/10805

See also:
https://github.com/v8/v8/wiki/Blink-layout-tests

Original issue's description:
> [profiler] Update cpu profile tracing format.
>
> Encapsulate nodes and samples into cpuProfile object.
>
> BUG=chromium:406277

TBR=caseq@chromium.org,lpy@chromium.org,yangguo@chromium.org,alph@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:406277

Review-Url: https://chromiumcodereview.appspot.com/2432373004
Cr-Commit-Position: refs/heads/master@{#40452}
parent e936685b
...@@ -412,7 +412,7 @@ CpuProfile::CpuProfile(CpuProfiler* profiler, const char* title, ...@@ -412,7 +412,7 @@ CpuProfile::CpuProfile(CpuProfiler* profiler, const char* title,
value->SetDouble("startTime", value->SetDouble("startTime",
(start_time_ - base::TimeTicks()).InMicroseconds()); (start_time_ - base::TimeTicks()).InMicroseconds());
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"), TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
"Profile", this, "data", std::move(value)); "CpuProfile", this, "data", std::move(value));
} }
void CpuProfile::AddPath(base::TimeTicks timestamp, void CpuProfile::AddPath(base::TimeTicks timestamp,
...@@ -466,8 +466,6 @@ void CpuProfile::StreamPendingTraceEvents() { ...@@ -466,8 +466,6 @@ void CpuProfile::StreamPendingTraceEvents() {
if (pending_nodes.empty() && !samples_.length()) return; if (pending_nodes.empty() && !samples_.length()) return;
auto value = TracedValue::Create(); auto value = TracedValue::Create();
if (!pending_nodes.empty() || streaming_next_sample_ != samples_.length()) {
value->BeginDictionary("cpuProfile");
if (!pending_nodes.empty()) { if (!pending_nodes.empty()) {
value->BeginArray("nodes"); value->BeginArray("nodes");
for (auto node : pending_nodes) { for (auto node : pending_nodes) {
...@@ -477,16 +475,13 @@ void CpuProfile::StreamPendingTraceEvents() { ...@@ -477,16 +475,13 @@ void CpuProfile::StreamPendingTraceEvents() {
} }
value->EndArray(); value->EndArray();
} }
if (streaming_next_sample_ != samples_.length()) { if (streaming_next_sample_ != samples_.length()) {
value->BeginArray("samples"); value->BeginArray("samples");
for (int i = streaming_next_sample_; i < samples_.length(); ++i) { for (int i = streaming_next_sample_; i < samples_.length(); ++i) {
value->AppendInteger(samples_[i]->id()); value->AppendInteger(samples_[i]->id());
} }
value->EndArray(); value->EndArray();
}
value->EndDictionary();
}
if (streaming_next_sample_ != samples_.length()) {
value->BeginArray("timeDeltas"); value->BeginArray("timeDeltas");
base::TimeTicks lastTimestamp = base::TimeTicks lastTimestamp =
streaming_next_sample_ ? timestamps_[streaming_next_sample_ - 1] streaming_next_sample_ ? timestamps_[streaming_next_sample_ - 1]
...@@ -502,7 +497,8 @@ void CpuProfile::StreamPendingTraceEvents() { ...@@ -502,7 +497,8 @@ void CpuProfile::StreamPendingTraceEvents() {
} }
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"), TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
"ProfileChunk", this, "data", std::move(value)); "CpuProfileChunk", this, "data",
std::move(value));
} }
void CpuProfile::FinishProfile() { void CpuProfile::FinishProfile() {
...@@ -511,7 +507,8 @@ void CpuProfile::FinishProfile() { ...@@ -511,7 +507,8 @@ void CpuProfile::FinishProfile() {
auto value = TracedValue::Create(); auto value = TracedValue::Create();
value->SetDouble("endTime", (end_time_ - base::TimeTicks()).InMicroseconds()); value->SetDouble("endTime", (end_time_ - base::TimeTicks()).InMicroseconds());
TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"), TRACE_EVENT_SAMPLE_WITH_ID1(TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"),
"ProfileChunk", this, "data", std::move(value)); "CpuProfileChunk", this, "data",
std::move(value));
} }
void CpuProfile::Print() { void CpuProfile::Print() {
......
...@@ -2111,8 +2111,8 @@ namespace { ...@@ -2111,8 +2111,8 @@ namespace {
class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter { class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter {
public: public:
void AppendTraceEvent(TraceObject* trace_event) override { void AppendTraceEvent(TraceObject* trace_event) override {
if (trace_event->name() != std::string("Profile") && if (trace_event->name() != std::string("CpuProfile") &&
trace_event->name() != std::string("ProfileChunk")) trace_event->name() != std::string("CpuProfileChunk"))
return; return;
CHECK(!profile_id_ || trace_event->id() == profile_id_); CHECK(!profile_id_ || trace_event->id() == profile_id_);
CHECK_EQ(1, trace_event->num_args()); CHECK_EQ(1, trace_event->num_args());
......
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