Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 4738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4749 case DO_NOTHING: | 4749 case DO_NOTHING: |
| 4750 break; | 4750 break; |
| 4751 } | 4751 } |
| 4752 | 4752 |
| 4753 return result; | 4753 return result; |
| 4754 } | 4754 } |
| 4755 | 4755 |
| 4756 | 4756 |
| 4757 void Heap::IdleNotificationEpilogue(GCIdleTimeAction action, | 4757 void Heap::IdleNotificationEpilogue(GCIdleTimeAction action, |
| 4758 GCIdleTimeHandler::HeapState heap_state, | 4758 GCIdleTimeHandler::HeapState heap_state, |
| 4759 double start_ms, double deadline_in_ms, | 4759 double start_ms, double deadline_in_ms) { |
| 4760 bool is_long_idle_notification) { | |
| 4761 double idle_time_in_ms = deadline_in_ms - start_ms; | 4760 double idle_time_in_ms = deadline_in_ms - start_ms; |
| 4762 double current_time = MonotonicallyIncreasingTimeInMs(); | 4761 double current_time = MonotonicallyIncreasingTimeInMs(); |
| 4763 last_idle_notification_time_ = current_time; | 4762 last_idle_notification_time_ = current_time; |
| 4764 double deadline_difference = deadline_in_ms - current_time; | 4763 double deadline_difference = deadline_in_ms - current_time; |
| 4765 | 4764 |
| 4766 contexts_disposed_ = 0; | 4765 contexts_disposed_ = 0; |
| 4767 | 4766 |
| 4768 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( | 4767 isolate()->counters()->gc_idle_time_allotted_in_ms()->AddSample( |
| 4769 static_cast<int>(idle_time_in_ms)); | 4768 static_cast<int>(idle_time_in_ms)); |
| 4770 | 4769 |
| 4771 if (is_long_idle_notification) { | |
| 4772 int committed_memory = static_cast<int>(CommittedMemory() / KB); | |
| 4773 int used_memory = static_cast<int>(heap_state.size_of_objects / KB); | |
| 4774 isolate()->counters()->aggregated_memory_heap_committed()->AddSample( | |
| 4775 start_ms, committed_memory); | |
| 4776 isolate()->counters()->aggregated_memory_heap_used()->AddSample( | |
| 4777 start_ms, used_memory); | |
|
ulan
2015/06/03 10:53:25
We already sample this after each scavenge. That s
| |
| 4778 } | |
| 4779 | |
| 4780 if (deadline_difference >= 0) { | 4770 if (deadline_difference >= 0) { |
| 4781 if (action.type != DONE && action.type != DO_NOTHING) { | 4771 if (action.type != DONE && action.type != DO_NOTHING) { |
| 4782 isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( | 4772 isolate()->counters()->gc_idle_time_limit_undershot()->AddSample( |
| 4783 static_cast<int>(deadline_difference)); | 4773 static_cast<int>(deadline_difference)); |
| 4784 } | 4774 } |
| 4785 } else { | 4775 } else { |
| 4786 isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( | 4776 isolate()->counters()->gc_idle_time_limit_overshot()->AddSample( |
| 4787 static_cast<int>(-deadline_difference)); | 4777 static_cast<int>(-deadline_difference)); |
| 4788 } | 4778 } |
| 4789 | 4779 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4823 | 4813 |
| 4824 bool Heap::IdleNotification(double deadline_in_seconds) { | 4814 bool Heap::IdleNotification(double deadline_in_seconds) { |
| 4825 CHECK(HasBeenSetUp()); | 4815 CHECK(HasBeenSetUp()); |
| 4826 double deadline_in_ms = | 4816 double deadline_in_ms = |
| 4827 deadline_in_seconds * | 4817 deadline_in_seconds * |
| 4828 static_cast<double>(base::Time::kMillisecondsPerSecond); | 4818 static_cast<double>(base::Time::kMillisecondsPerSecond); |
| 4829 HistogramTimerScope idle_notification_scope( | 4819 HistogramTimerScope idle_notification_scope( |
| 4830 isolate_->counters()->gc_idle_notification()); | 4820 isolate_->counters()->gc_idle_notification()); |
| 4831 double start_ms = MonotonicallyIncreasingTimeInMs(); | 4821 double start_ms = MonotonicallyIncreasingTimeInMs(); |
| 4832 double idle_time_in_ms = deadline_in_ms - start_ms; | 4822 double idle_time_in_ms = deadline_in_ms - start_ms; |
| 4833 bool is_long_idle_notification = | |
| 4834 static_cast<size_t>(idle_time_in_ms) > | |
| 4835 GCIdleTimeHandler::kMaxFrameRenderingIdleTime; | |
| 4836 | 4823 |
| 4837 if (is_long_idle_notification) { | 4824 tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(), |
|
ulan
2015/06/03 10:53:25
Added a guard in SampleAllocation to not sample to
| |
| 4838 tracer()->SampleAllocation(start_ms, NewSpaceAllocationCounter(), | 4825 OldGenerationAllocationCounter()); |
| 4839 OldGenerationAllocationCounter()); | |
| 4840 } | |
| 4841 | 4826 |
| 4842 GCIdleTimeHandler::HeapState heap_state = ComputeHeapState(); | 4827 GCIdleTimeHandler::HeapState heap_state = ComputeHeapState(); |
| 4843 | 4828 |
| 4844 GCIdleTimeAction action = | 4829 GCIdleTimeAction action = |
| 4845 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); | 4830 gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); |
| 4846 | 4831 |
| 4847 bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms, | 4832 bool result = PerformIdleTimeAction(action, heap_state, deadline_in_ms, |
| 4848 is_long_idle_notification); | 4833 is_long_idle_notification); |
| 4849 | 4834 |
| 4850 IdleNotificationEpilogue(action, heap_state, start_ms, deadline_in_ms, | 4835 IdleNotificationEpilogue(action, heap_state, start_ms, deadline_in_ms); |
| 4851 is_long_idle_notification); | |
| 4852 return result; | 4836 return result; |
| 4853 } | 4837 } |
| 4854 | 4838 |
| 4855 | 4839 |
| 4856 bool Heap::RecentIdleNotificationHappened() { | 4840 bool Heap::RecentIdleNotificationHappened() { |
| 4857 return (last_idle_notification_time_ + | 4841 return (last_idle_notification_time_ + |
| 4858 GCIdleTimeHandler::kMaxScheduledIdleTime) > | 4842 GCIdleTimeHandler::kMaxScheduledIdleTime) > |
| 4859 MonotonicallyIncreasingTimeInMs(); | 4843 MonotonicallyIncreasingTimeInMs(); |
| 4860 } | 4844 } |
| 4861 | 4845 |
| (...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6671 *object_type = "CODE_TYPE"; \ | 6655 *object_type = "CODE_TYPE"; \ |
| 6672 *object_sub_type = "CODE_AGE/" #name; \ | 6656 *object_sub_type = "CODE_AGE/" #name; \ |
| 6673 return true; | 6657 return true; |
| 6674 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6658 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
| 6675 #undef COMPARE_AND_RETURN_NAME | 6659 #undef COMPARE_AND_RETURN_NAME |
| 6676 } | 6660 } |
| 6677 return false; | 6661 return false; |
| 6678 } | 6662 } |
| 6679 } // namespace internal | 6663 } // namespace internal |
| 6680 } // namespace v8 | 6664 } // namespace v8 |
| OLD | NEW |