| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
| 6 | 6 |
| 7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
| 8 #include "vm/hash_map.h" | 8 #include "vm/hash_map.h" |
| 9 #include "vm/log.h" | 9 #include "vm/log.h" |
| 10 #include "vm/native_symbol.h" | 10 #include "vm/native_symbol.h" |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 | 2441 |
| 2442 void Profile::PrintHeaderJSON(JSONObject* obj) { | 2442 void Profile::PrintHeaderJSON(JSONObject* obj) { |
| 2443 obj->AddProperty("samplePeriod", | 2443 obj->AddProperty("samplePeriod", |
| 2444 static_cast<intptr_t>(FLAG_profile_period)); | 2444 static_cast<intptr_t>(FLAG_profile_period)); |
| 2445 obj->AddProperty("stackDepth", | 2445 obj->AddProperty("stackDepth", |
| 2446 static_cast<intptr_t>(FLAG_max_profile_depth)); | 2446 static_cast<intptr_t>(FLAG_max_profile_depth)); |
| 2447 obj->AddProperty("sampleCount", sample_count()); | 2447 obj->AddProperty("sampleCount", sample_count()); |
| 2448 obj->AddProperty("timeSpan", MicrosecondsToSeconds(GetTimeSpan())); | 2448 obj->AddProperty("timeSpan", MicrosecondsToSeconds(GetTimeSpan())); |
| 2449 obj->AddPropertyTimeMicros("timeOriginMicros", min_time()); | 2449 obj->AddPropertyTimeMicros("timeOriginMicros", min_time()); |
| 2450 obj->AddPropertyTimeMicros("timeExtentMicros", GetTimeSpan()); | 2450 obj->AddPropertyTimeMicros("timeExtentMicros", GetTimeSpan()); |
| 2451 |
| 2452 ProfilerCounters counters = Profiler::counters(); |
| 2453 { |
| 2454 JSONObject counts(obj, "counters"); |
| 2455 counts.AddProperty64( |
| 2456 "bail_out_unknown_task", |
| 2457 counters.bail_out_unknown_task); |
| 2458 counts.AddProperty64( |
| 2459 "bail_out_jump_to_exception_handler", |
| 2460 counters.bail_out_jump_to_exception_handler); |
| 2461 counts.AddProperty64( |
| 2462 "bail_out_check_isolate", |
| 2463 counters.bail_out_check_isolate); |
| 2464 counts.AddProperty64( |
| 2465 "single_frame_sample_deoptimizing", |
| 2466 counters.single_frame_sample_deoptimizing); |
| 2467 counts.AddProperty64( |
| 2468 "single_frame_sample_register_check", |
| 2469 counters.single_frame_sample_register_check); |
| 2470 counts.AddProperty64( |
| 2471 "single_frame_sample_get_and_validate_stack_bounds", |
| 2472 counters.single_frame_sample_get_and_validate_stack_bounds); |
| 2473 counts.AddProperty64( |
| 2474 "stack_walker_native", |
| 2475 counters.stack_walker_native); |
| 2476 counts.AddProperty64( |
| 2477 "stack_walker_dart_exit", |
| 2478 counters.stack_walker_dart_exit); |
| 2479 counts.AddProperty64( |
| 2480 "stack_walker_dart", |
| 2481 counters.stack_walker_dart); |
| 2482 counts.AddProperty64( |
| 2483 "stack_walker_none", |
| 2484 counters.stack_walker_none); |
| 2485 } |
| 2451 } | 2486 } |
| 2452 | 2487 |
| 2453 | 2488 |
| 2454 void Profile::PrintTimelineFrameJSON(JSONObject* frames, | 2489 void Profile::PrintTimelineFrameJSON(JSONObject* frames, |
| 2455 ProfileTrieNode* current, | 2490 ProfileTrieNode* current, |
| 2456 ProfileTrieNode* parent, | 2491 ProfileTrieNode* parent, |
| 2457 intptr_t* next_id) { | 2492 intptr_t* next_id) { |
| 2458 ASSERT(current->frame_id() == -1); | 2493 ASSERT(current->frame_id() == -1); |
| 2459 const intptr_t id = *next_id; | 2494 const intptr_t id = *next_id; |
| 2460 *next_id = id + 1; | 2495 *next_id = id + 1; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 // Disable thread interrupts while processing the buffer. | 2895 // Disable thread interrupts while processing the buffer. |
| 2861 DisableThreadInterruptsScope dtis(thread); | 2896 DisableThreadInterruptsScope dtis(thread); |
| 2862 | 2897 |
| 2863 ClearProfileVisitor clear_profile(isolate); | 2898 ClearProfileVisitor clear_profile(isolate); |
| 2864 sample_buffer->VisitSamples(&clear_profile); | 2899 sample_buffer->VisitSamples(&clear_profile); |
| 2865 } | 2900 } |
| 2866 | 2901 |
| 2867 #endif // !PRODUCT | 2902 #endif // !PRODUCT |
| 2868 | 2903 |
| 2869 } // namespace dart | 2904 } // namespace dart |
| OLD | NEW |