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

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

Issue 192443004: Complete the switch to ServiceObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void PrintNativeCode(JSONObject* profile_code_obj) { 335 void PrintNativeCode(JSONObject* profile_code_obj) {
336 ASSERT(kind() == kNativeCode); 336 ASSERT(kind() == kNativeCode);
337 JSONObject obj(profile_code_obj, "code"); 337 JSONObject obj(profile_code_obj, "code");
338 obj.AddProperty("type", "@Code"); 338 obj.AddProperty("type", "@Code");
339 obj.AddProperty("kind", "Native"); 339 obj.AddProperty("kind", "Native");
340 obj.AddProperty("name", name()); 340 obj.AddProperty("name", name());
341 obj.AddProperty("user_name", name()); 341 obj.AddProperty("user_name", name());
342 obj.AddPropertyF("start", "%" Px "", start()); 342 obj.AddPropertyF("start", "%" Px "", start());
343 obj.AddPropertyF("end", "%" Px "", end()); 343 obj.AddPropertyF("end", "%" Px "", end());
344 obj.AddPropertyF("id", "code/native/%" Px "", start()); 344 obj.AddPropertyF("id", "code/native/%" Px "", start());
345 {
346 // Generate a fake function entry.
347 JSONObject func(&obj, "function");
348 func.AddProperty("type", "@Function");
349 func.AddPropertyF("id", "native/functions/%" Pd "", start());
350 func.AddProperty("name", name());
351 func.AddProperty("user_name", name());
352 func.AddProperty("kind", "Native");
353 }
345 } 354 }
346 355
347 void PrintCollectedCode(JSONObject* profile_code_obj) { 356 void PrintCollectedCode(JSONObject* profile_code_obj) {
348 ASSERT(kind() == kCollectedCode); 357 ASSERT(kind() == kCollectedCode);
349 JSONObject obj(profile_code_obj, "code"); 358 JSONObject obj(profile_code_obj, "code");
350 obj.AddProperty("type", "@Code"); 359 obj.AddProperty("type", "@Code");
351 obj.AddProperty("kind", "Collected"); 360 obj.AddProperty("kind", "Collected");
352 obj.AddProperty("name", name()); 361 obj.AddProperty("name", name());
353 obj.AddProperty("user_name", name()); 362 obj.AddProperty("user_name", name());
354 obj.AddPropertyF("start", "%" Px "", start()); 363 obj.AddPropertyF("start", "%" Px "", start());
355 obj.AddPropertyF("end", "%" Px "", end()); 364 obj.AddPropertyF("end", "%" Px "", end());
356 obj.AddPropertyF("id", "code/collected/%" Px "", start()); 365 obj.AddPropertyF("id", "code/collected/%" Px "", start());
366 {
367 // Generate a fake function entry.
368 JSONObject func(&obj, "function");
369 func.AddProperty("type", "@Function");
370 func.AddPropertyF("id", "collected/functions/%" Pd "", start());
371 func.AddProperty("name", name());
372 func.AddProperty("user_name", name());
373 func.AddProperty("kind", "Collected");
374 }
357 } 375 }
358 376
359 void PrintToJSONArray(Isolate* isolate, JSONArray* events, bool full) { 377 void PrintToJSONArray(Isolate* isolate, JSONArray* events, bool full) {
360 JSONObject obj(events); 378 JSONObject obj(events);
361 obj.AddProperty("type", "ProfileCode"); 379 obj.AddProperty("type", "ProfileCode");
362 obj.AddProperty("kind", KindToCString(kind())); 380 obj.AddProperty("kind", KindToCString(kind()));
363 obj.AddPropertyF("inclusive_ticks", "%" Pd "", inclusive_ticks()); 381 obj.AddPropertyF("inclusive_ticks", "%" Pd "", inclusive_ticks());
364 obj.AddPropertyF("exclusive_ticks", "%" Pd "", exclusive_ticks()); 382 obj.AddPropertyF("exclusive_ticks", "%" Pd "", exclusive_ticks());
365 if (kind() == kDartCode) { 383 if (kind() == kDartCode) {
366 // Look up code in Dart heap. 384 // Look up code in Dart heap.
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 intptr_t frames = builder.frames(); 835 intptr_t frames = builder.frames();
818 if (FLAG_trace_profiled_isolates) { 836 if (FLAG_trace_profiled_isolates) {
819 OS::Print("%" Pd " frames produced %" Pd " code objects.\n", 837 OS::Print("%" Pd " frames produced %" Pd " code objects.\n",
820 frames, code_region_table.Length()); 838 frames, code_region_table.Length());
821 } 839 }
822 { 840 {
823 ScopeStopwatch sw("CodeTableStream"); 841 ScopeStopwatch sw("CodeTableStream");
824 // Serialize to JSON. 842 // Serialize to JSON.
825 JSONObject obj(stream); 843 JSONObject obj(stream);
826 obj.AddProperty("type", "Profile"); 844 obj.AddProperty("type", "Profile");
845 obj.AddProperty("id", "profile");
827 obj.AddProperty("samples", samples); 846 obj.AddProperty("samples", samples);
828 obj.AddProperty("time_delta_micros", builder.TimeDeltaMicros()); 847 obj.AddProperty("time_delta_micros", builder.TimeDeltaMicros());
829 JSONArray codes(&obj, "codes"); 848 JSONArray codes(&obj, "codes");
830 for (intptr_t i = 0; i < code_region_table.Length(); i++) { 849 for (intptr_t i = 0; i < code_region_table.Length(); i++) {
831 CodeRegion* region = code_region_table.At(i); 850 CodeRegion* region = code_region_table.At(i);
832 ASSERT(region != NULL); 851 ASSERT(region != NULL);
833 region->PrintToJSONArray(isolate, &codes, full); 852 region->PrintToJSONArray(isolate, &codes, full);
834 } 853 }
835 } 854 }
836 } 855 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 stack_lower = 0; 1070 stack_lower = 0;
1052 stack_upper = 0; 1071 stack_upper = 0;
1053 } 1072 }
1054 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper, 1073 ProfilerSampleStackWalker stackWalker(sample, stack_lower, stack_upper,
1055 state.pc, state.fp, state.sp); 1074 state.pc, state.fp, state.sp);
1056 stackWalker.walk(isolate->heap()); 1075 stackWalker.walk(isolate->heap());
1057 } 1076 }
1058 1077
1059 1078
1060 } // namespace dart 1079 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698