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

Side by Side Diff: runtime/vm/json_stream.cc

Issue 2583663002: Internally measure isolate uptime with monotonic time. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/json_stream.h" 10 #include "vm/json_stream.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 SetParams(param_keys_native, param_values_native, param_keys.Length()); 102 SetParams(param_keys_native, param_values_native, param_keys.Length());
103 } 103 }
104 104
105 if (FLAG_trace_service) { 105 if (FLAG_trace_service) {
106 Isolate* isolate = Isolate::Current(); 106 Isolate* isolate = Isolate::Current();
107 ASSERT(isolate != NULL); 107 ASSERT(isolate != NULL);
108 const char* isolate_name = isolate->name(); 108 const char* isolate_name = isolate->name();
109 setup_time_micros_ = OS::GetCurrentTimeMicros(); 109 setup_time_micros_ = OS::GetCurrentTimeMicros();
110 OS::Print("[+%" Pd64 "ms] Isolate %s processing service request %s\n", 110 OS::Print("[+%" Pd64 "ms] Isolate %s processing service request %s\n",
111 Dart::timestamp(), isolate_name, method_); 111 Dart::UptimeMillis(), isolate_name, method_);
112 } 112 }
113 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); 113 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":");
114 } 114 }
115 115
116 116
117 void JSONStream::SetupError() { 117 void JSONStream::SetupError() {
118 buffer_.Clear(); 118 buffer_.Clear();
119 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); 119 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":");
120 } 120 }
121 121
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 if (FLAG_trace_service) { 260 if (FLAG_trace_service) {
261 Isolate* isolate = Isolate::Current(); 261 Isolate* isolate = Isolate::Current();
262 ASSERT(isolate != NULL); 262 ASSERT(isolate != NULL);
263 const char* isolate_name = isolate->name(); 263 const char* isolate_name = isolate->name();
264 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; 264 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_;
265 if (result) { 265 if (result) {
266 OS::Print("[+%" Pd64 266 OS::Print("[+%" Pd64
267 "ms] Isolate %s processed service request %s " 267 "ms] Isolate %s processed service request %s "
268 "(%" Pd64 "us)\n", 268 "(%" Pd64 "us)\n",
269 Dart::timestamp(), isolate_name, method_, total_time); 269 Dart::UptimeMillis(), isolate_name, method_, total_time);
270 } else { 270 } else {
271 OS::Print("[+%" Pd64 271 OS::Print("[+%" Pd64
272 "ms] Isolate %s processed service request %s " 272 "ms] Isolate %s processed service request %s "
273 "(%" Pd64 "us) FAILED\n", 273 "(%" Pd64 "us) FAILED\n",
274 Dart::timestamp(), isolate_name, method_, total_time); 274 Dart::UptimeMillis(), isolate_name, method_, total_time);
275 } 275 }
276 } 276 }
277 } 277 }
278 278
279 279
280 const char* JSONStream::LookupParam(const char* key) const { 280 const char* JSONStream::LookupParam(const char* key) const {
281 for (int i = 0; i < num_params(); i++) { 281 for (int i = 0; i < num_params(); i++) {
282 if (!strcmp(key, param_keys_[i])) { 282 if (!strcmp(key, param_keys_[i])) {
283 return param_values_[i]; 283 return param_values_[i];
284 } 284 }
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 ASSERT(len == len2); 1022 ASSERT(len == len2);
1023 stream_->buffer_.AddChar('"'); 1023 stream_->buffer_.AddChar('"');
1024 stream_->AddEscapedUTF8String(p); 1024 stream_->AddEscapedUTF8String(p);
1025 stream_->buffer_.AddChar('"'); 1025 stream_->buffer_.AddChar('"');
1026 free(p); 1026 free(p);
1027 } 1027 }
1028 1028
1029 #endif // !PRODUCT 1029 #endif // !PRODUCT
1030 1030
1031 } // namespace dart 1031 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698