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

Side by Side Diff: src/heap/memory-reducer.cc

Issue 1472193003: Double the API call rate threshold for the memory reducer to kick in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/heap/memory-reducer.h" 5 #include "src/heap/memory-reducer.h"
6 6
7 #include "src/flags.h" 7 #include "src/flags.h"
8 #include "src/heap/gc-tracer.h" 8 #include "src/heap/gc-tracer.h"
9 #include "src/heap/heap-inl.h" 9 #include "src/heap/heap-inl.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
11 #include "src/v8.h" 11 #include "src/v8.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 const int MemoryReducer::kLongDelayMs = 8000; 16 const int MemoryReducer::kLongDelayMs = 8000;
17 const int MemoryReducer::kShortDelayMs = 500; 17 const int MemoryReducer::kShortDelayMs = 500;
18 const int MemoryReducer::kWatchdogDelayMs = 100000; 18 const int MemoryReducer::kWatchdogDelayMs = 100000;
19 const int MemoryReducer::kMaxNumberOfGCs = 3; 19 const int MemoryReducer::kMaxNumberOfGCs = 3;
20 20
21 MemoryReducer::TimerTask::TimerTask(MemoryReducer* memory_reducer) 21 MemoryReducer::TimerTask::TimerTask(MemoryReducer* memory_reducer)
22 : CancelableTask(memory_reducer->heap()->isolate()), 22 : CancelableTask(memory_reducer->heap()->isolate()),
23 memory_reducer_(memory_reducer) {} 23 memory_reducer_(memory_reducer) {}
24 24
25 25
26 void MemoryReducer::TimerTask::RunInternal() { 26 void MemoryReducer::TimerTask::RunInternal() {
27 const double kJsCallsPerMsThreshold = 0.25; 27 const double kJsCallsPerMsThreshold = 0.5;
28 Heap* heap = memory_reducer_->heap(); 28 Heap* heap = memory_reducer_->heap();
29 Event event; 29 Event event;
30 double time_ms = heap->MonotonicallyIncreasingTimeInMs(); 30 double time_ms = heap->MonotonicallyIncreasingTimeInMs();
31 heap->tracer()->SampleAllocation(time_ms, heap->NewSpaceAllocationCounter(), 31 heap->tracer()->SampleAllocation(time_ms, heap->NewSpaceAllocationCounter(),
32 heap->OldGenerationAllocationCounter()); 32 heap->OldGenerationAllocationCounter());
33 double js_call_rate = memory_reducer_->SampleAndGetJsCallsPerMs(time_ms); 33 double js_call_rate = memory_reducer_->SampleAndGetJsCallsPerMs(time_ms);
34 bool low_allocation_rate = heap->HasLowAllocationRate(); 34 bool low_allocation_rate = heap->HasLowAllocationRate();
35 bool is_idle = js_call_rate < kJsCallsPerMsThreshold && low_allocation_rate; 35 bool is_idle = js_call_rate < kJsCallsPerMsThreshold && low_allocation_rate;
36 bool optimize_for_memory = heap->ShouldOptimizeForMemoryUsage(); 36 bool optimize_for_memory = heap->ShouldOptimizeForMemoryUsage();
37 if (FLAG_trace_gc_verbose) { 37 if (FLAG_trace_gc_verbose) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 auto timer_task = new MemoryReducer::TimerTask(this); 211 auto timer_task = new MemoryReducer::TimerTask(this);
212 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread( 212 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(
213 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0); 213 isolate, timer_task, (delay_ms + kSlackMs) / 1000.0);
214 } 214 }
215 215
216 216
217 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); } 217 void MemoryReducer::TearDown() { state_ = State(kDone, 0, 0, 0.0); }
218 218
219 } // namespace internal 219 } // namespace internal
220 } // namespace v8 220 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698