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

Unified Diff: src/counters.cc

Issue 2418303002: Use TracedValue in runtime statistics. (Closed)
Patch Set: rebase 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 | « src/counters.h ('k') | src/tracing/trace-event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index df75e212791d1743001334ae4047e761d6d62f18..8fcfd541411d433911bf2003d4ce46d8535ff873 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -277,9 +277,11 @@ void RuntimeCallCounter::Reset() {
time = base::TimeDelta();
}
-void RuntimeCallCounter::Dump(std::stringstream& out) {
- out << "\"" << name << "\":[" << count << "," << time.InMicroseconds()
- << "],";
+void RuntimeCallCounter::Dump(v8::tracing::TracedValue* value) {
+ value->BeginArray(name);
+ value->AppendLongInteger(count);
+ value->AppendLongInteger(time.InMicroseconds());
+ value->EndArray();
}
// static
@@ -365,37 +367,33 @@ void RuntimeCallStats::Reset() {
in_use_ = true;
}
-std::string RuntimeCallStats::Dump() {
- buffer_.str(std::string());
- buffer_.clear();
- buffer_ << "{";
+void RuntimeCallStats::Dump(v8::tracing::TracedValue* value) {
#define DUMP_COUNTER(name) \
- if (this->name.count > 0) this->name.Dump(buffer_);
+ if (this->name.count > 0) this->name.Dump(value);
FOR_EACH_MANUAL_COUNTER(DUMP_COUNTER)
#undef DUMP_COUNTER
#define DUMP_COUNTER(name, nargs, result_size) \
- if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(buffer_);
+ if (this->Runtime_##name.count > 0) this->Runtime_##name.Dump(value);
FOR_EACH_INTRINSIC(DUMP_COUNTER)
#undef DUMP_COUNTER
#define DUMP_COUNTER(name) \
- if (this->Builtin_##name.count > 0) this->Builtin_##name.Dump(buffer_);
+ if (this->Builtin_##name.count > 0) this->Builtin_##name.Dump(value);
BUILTIN_LIST_C(DUMP_COUNTER)
#undef DUMP_COUNTER
#define DUMP_COUNTER(name) \
- if (this->API_##name.count > 0) this->API_##name.Dump(buffer_);
+ if (this->API_##name.count > 0) this->API_##name.Dump(value);
FOR_EACH_API_COUNTER(DUMP_COUNTER)
#undef DUMP_COUNTER
#define DUMP_COUNTER(name) \
- if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_);
+ if (this->Handler_##name.count > 0) this->Handler_##name.Dump(value);
FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER)
#undef DUMP_COUNTER
- buffer_ << "\"END\":[]}";
+
in_use_ = false;
- return buffer_.str();
}
} // namespace internal
« no previous file with comments | « src/counters.h ('k') | src/tracing/trace-event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698