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

Unified Diff: runtime/vm/json_stream.cc

Issue 464953002: Add VMMetric and some sample metrics (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/metrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/json_stream.cc
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index d72ff5bd765090a135348fd253d7c6b2b676e414..762124d1c26f04caebca29650c765a6645192107 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -8,6 +8,7 @@
#include "vm/debugger.h"
#include "vm/json_stream.h"
#include "vm/message.h"
+#include "vm/metrics.h"
#include "vm/object.h"
#include "vm/unicode.h"
@@ -259,6 +260,12 @@ void JSONStream::PrintValue(const DebuggerEvent* event) {
}
+void JSONStream::PrintValue(Metric* metric) {
+ PrintCommaIfNeeded();
+ metric->PrintJSON(this);
+}
+
+
void JSONStream::PrintValue(Isolate* isolate, bool ref) {
PrintCommaIfNeeded();
isolate->PrintJSON(this, ref);
@@ -313,6 +320,11 @@ void JSONStream::PrintProperty(const char* name, SourceBreakpoint* bpt) {
}
+void JSONStream::PrintProperty(const char* name, Metric* metric) {
+ PrintPropertyName(name);
+ PrintValue(metric);
+}
+
void JSONStream::PrintProperty(const char* name, Isolate* isolate) {
PrintPropertyName(name);
PrintValue(isolate);
@@ -396,6 +408,9 @@ bool JSONStream::NeedComma() {
void JSONStream::AddEscapedUTF8String(const char* s) {
+ if (s == NULL) {
+ return;
+ }
intptr_t len = strlen(s);
const uint8_t* s8 = reinterpret_cast<const uint8_t*>(s);
intptr_t i = 0;
« no previous file with comments | « runtime/vm/json_stream.h ('k') | runtime/vm/metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698