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

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

Issue 257053003: Always use the same json for null in the vm service. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/service.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/utils.h" 5 #include "platform/utils.h"
6 6
7 #include "vm/allocation.h" 7 #include "vm/allocation.h"
8 #include "vm/atomic.h" 8 #include "vm/atomic.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 1320
1321 CodeRegionTrieNode* exclusive_root_; 1321 CodeRegionTrieNode* exclusive_root_;
1322 CodeRegionTable* live_code_table_; 1322 CodeRegionTable* live_code_table_;
1323 CodeRegionTable* dead_code_table_; 1323 CodeRegionTable* dead_code_table_;
1324 CodeRegionTable* tag_code_table_; 1324 CodeRegionTable* tag_code_table_;
1325 intptr_t dead_code_table_offset_; 1325 intptr_t dead_code_table_offset_;
1326 intptr_t tag_code_table_offset_; 1326 intptr_t tag_code_table_offset_;
1327 }; 1327 };
1328 1328
1329 1329
1330 void Profiler::PrintToJSONStream(Isolate* isolate, JSONStream* stream, 1330 void Profiler::PrintJSON(Isolate* isolate, JSONStream* stream,
1331 bool full, TagOrder tag_order) { 1331 bool full, TagOrder tag_order) {
1332 ASSERT(isolate == Isolate::Current()); 1332 ASSERT(isolate == Isolate::Current());
1333 // Disable profile interrupts while processing the buffer. 1333 // Disable profile interrupts while processing the buffer.
1334 EndExecution(isolate); 1334 EndExecution(isolate);
1335 MutexLocker profiler_data_lock(isolate->profiler_data_mutex()); 1335 MutexLocker profiler_data_lock(isolate->profiler_data_mutex());
1336 IsolateProfilerData* profiler_data = isolate->profiler_data(); 1336 IsolateProfilerData* profiler_data = isolate->profiler_data();
1337 if (profiler_data == NULL) { 1337 if (profiler_data == NULL) {
1338 JSONObject error(stream); 1338 JSONObject error(stream);
1339 error.AddProperty("type", "Error"); 1339 error.AddProperty("type", "Error");
1340 error.AddProperty("text", "Isolate does not have profiling enabled."); 1340 error.AddProperty("text", "Isolate does not have profiling enabled.");
1341 return; 1341 return;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); 1456 Dart_FileCloseCallback file_close = Isolate::file_close_callback();
1457 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); 1457 Dart_FileWriteCallback file_write = Isolate::file_write_callback();
1458 if ((file_open == NULL) || (file_close == NULL) || (file_write == NULL)) { 1458 if ((file_open == NULL) || (file_close == NULL) || (file_write == NULL)) {
1459 // Embedder has not provided necessary callbacks. 1459 // Embedder has not provided necessary callbacks.
1460 return; 1460 return;
1461 } 1461 }
1462 // We will be looking up code objects within the isolate. 1462 // We will be looking up code objects within the isolate.
1463 ASSERT(Isolate::Current() == isolate); 1463 ASSERT(Isolate::Current() == isolate);
1464 JSONStream stream(10 * MB); 1464 JSONStream stream(10 * MB);
1465 intptr_t pid = OS::ProcessId(); 1465 intptr_t pid = OS::ProcessId();
1466 PrintToJSONStream(isolate, &stream, true, Profiler::kNoTags); 1466 PrintJSON(isolate, &stream, true, Profiler::kNoTags);
1467 const char* format = "%s/dart-profile-%" Pd "-%" Pd ".json"; 1467 const char* format = "%s/dart-profile-%" Pd "-%" Pd ".json";
1468 intptr_t len = OS::SNPrint(NULL, 0, format, 1468 intptr_t len = OS::SNPrint(NULL, 0, format,
1469 FLAG_profile_dir, pid, isolate->main_port()); 1469 FLAG_profile_dir, pid, isolate->main_port());
1470 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1); 1470 char* filename = Isolate::Current()->current_zone()->Alloc<char>(len + 1);
1471 OS::SNPrint(filename, len + 1, format, 1471 OS::SNPrint(filename, len + 1, format,
1472 FLAG_profile_dir, pid, isolate->main_port()); 1472 FLAG_profile_dir, pid, isolate->main_port());
1473 void* f = file_open(filename, true); 1473 void* f = file_open(filename, true);
1474 if (f == NULL) { 1474 if (f == NULL) {
1475 // Cannot write. 1475 // Cannot write.
1476 return; 1476 return;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 ProfilerDartStackWalker stackWalker(sample); 1723 ProfilerDartStackWalker stackWalker(sample);
1724 stackWalker.walk(); 1724 stackWalker.walk();
1725 } else { 1725 } else {
1726 // TODO(johnmccutchan): Support collecting only Dart frames with 1726 // TODO(johnmccutchan): Support collecting only Dart frames with
1727 // ProfilerNativeStackWalker. 1727 // ProfilerNativeStackWalker.
1728 } 1728 }
1729 } 1729 }
1730 } 1730 }
1731 1731
1732 } // namespace dart 1732 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698