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 |