| OLD | NEW |
| 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 "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
| 10 #include "vm/message.h" | 10 #include "vm/message.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 param_values_native[i] = | 73 param_values_native[i] = |
| 74 zone->MakeCopyOfString(string_iterator.ToCString()); | 74 zone->MakeCopyOfString(string_iterator.ToCString()); |
| 75 } | 75 } |
| 76 SetParams(param_keys_native, param_values_native, param_keys.Length()); | 76 SetParams(param_keys_native, param_values_native, param_keys.Length()); |
| 77 } | 77 } |
| 78 if (FLAG_trace_service) { | 78 if (FLAG_trace_service) { |
| 79 Isolate* isolate = Isolate::Current(); | 79 Isolate* isolate = Isolate::Current(); |
| 80 ASSERT(isolate != NULL); | 80 ASSERT(isolate != NULL); |
| 81 const char* isolate_name = isolate->name(); | 81 const char* isolate_name = isolate->name(); |
| 82 setup_time_micros_ = OS::GetCurrentTimeMicros(); | 82 setup_time_micros_ = OS::GetCurrentTimeMicros(); |
| 83 int64_t timestamp = setup_time_micros_ - Dart::vm_isolate()->start_time(); | 83 OS::Print("[+%" Pd64 "ms] Isolate %s processing service request %s\n", |
| 84 OS::Print("[@%" Pd64 "] Isolate %s processing service request %s\n", | 84 Dart::timestamp(), isolate_name, method_); |
| 85 timestamp, isolate_name, method_); | |
| 86 } | 85 } |
| 87 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); | 86 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":"); |
| 88 } | 87 } |
| 89 | 88 |
| 90 | 89 |
| 91 void JSONStream::SetupError() { | 90 void JSONStream::SetupError() { |
| 92 buffer_.Clear(); | 91 buffer_.Clear(); |
| 93 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); | 92 buffer_.Printf("{\"jsonrpc\":\"2.0\", \"error\":"); |
| 94 } | 93 } |
| 95 | 94 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 uint8_t* data = NULL; | 195 uint8_t* data = NULL; |
| 197 MessageWriter writer(&data, &allocator, false); | 196 MessageWriter writer(&data, &allocator, false); |
| 198 writer.WriteMessage(reply); | 197 writer.WriteMessage(reply); |
| 199 bool result = PortMap::PostMessage(new Message(port, data, | 198 bool result = PortMap::PostMessage(new Message(port, data, |
| 200 writer.BytesWritten(), | 199 writer.BytesWritten(), |
| 201 Message::kNormalPriority)); | 200 Message::kNormalPriority)); |
| 202 if (FLAG_trace_service) { | 201 if (FLAG_trace_service) { |
| 203 Isolate* isolate = Isolate::Current(); | 202 Isolate* isolate = Isolate::Current(); |
| 204 ASSERT(isolate != NULL); | 203 ASSERT(isolate != NULL); |
| 205 const char* isolate_name = isolate->name(); | 204 const char* isolate_name = isolate->name(); |
| 206 int64_t current_time = OS::GetCurrentTimeMicros(); | 205 int64_t total_time = OS::GetCurrentTimeMicros() - setup_time_micros_; |
| 207 int64_t process_delta_micros = current_time - setup_time_micros_; | |
| 208 int64_t timestamp = current_time - Dart::vm_isolate()->start_time(); | |
| 209 if (result) { | 206 if (result) { |
| 210 OS::Print("[@%" Pd64 "] Isolate %s processed service request %s " | 207 OS::Print("[+%" Pd64 "ms] Isolate %s processed service request %s " |
| 211 "(%" Pd64 "us)\n", | 208 "(%" Pd64 "us)\n", |
| 212 timestamp, isolate_name, method_, process_delta_micros); | 209 Dart::timestamp(), isolate_name, method_, total_time); |
| 213 } else { | 210 } else { |
| 214 OS::Print("[@%" Pd64 "] Isolate %s processed service request %s " | 211 OS::Print("[+%" Pd64 "ms] Isolate %s processed service request %s " |
| 215 "(%" Pd64 "us) FAILED\n", | 212 "(%" Pd64 "us) FAILED\n", |
| 216 timestamp, isolate_name, method_, process_delta_micros); | 213 Dart::timestamp(), isolate_name, method_, total_time); |
| 217 } | 214 } |
| 218 } | 215 } |
| 219 } | 216 } |
| 220 | 217 |
| 221 | 218 |
| 222 const char* JSONStream::LookupParam(const char* key) const { | 219 const char* JSONStream::LookupParam(const char* key) const { |
| 223 for (int i = 0; i < num_params(); i++) { | 220 for (int i = 0; i < num_params(); i++) { |
| 224 if (!strcmp(key, param_keys_[i])) { | 221 if (!strcmp(key, param_keys_[i])) { |
| 225 return param_values_[i]; | 222 return param_values_[i]; |
| 226 } | 223 } |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 ASSERT(len == len2); | 854 ASSERT(len == len2); |
| 858 stream_->buffer_.AddChar('"'); | 855 stream_->buffer_.AddChar('"'); |
| 859 stream_->AddEscapedUTF8String(p); | 856 stream_->AddEscapedUTF8String(p); |
| 860 stream_->buffer_.AddChar('"'); | 857 stream_->buffer_.AddChar('"'); |
| 861 free(p); | 858 free(p); |
| 862 } | 859 } |
| 863 | 860 |
| 864 #endif // !PRODUCT | 861 #endif // !PRODUCT |
| 865 | 862 |
| 866 } // namespace dart | 863 } // namespace dart |
| OLD | NEW |