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

Side by Side Diff: chrome/browser/renderer_host/render_process_host.cc

Issue 21484: Update the table of RAM vs number of renderers... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium 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 "chrome/browser/renderer_host/render_process_host.h" 5 #include "chrome/browser/renderer_host/render_process_host.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "chrome/common/chrome_constants.h" 9 #include "chrome/common/chrome_constants.h"
10 #include "chrome/common/notification_service.h" 10 #include "chrome/common/notification_service.h"
11 11
12 namespace { 12 namespace {
13 13
14 unsigned int GetMaxRendererProcessCount() { 14 unsigned int GetMaxRendererProcessCount() {
15 // Defines the maximum number of renderer processes according to the 15 // Defines the maximum number of renderer processes according to the
16 // amount of installed memory as reported by the OS. The table 16 // amount of installed memory as reported by the OS. The table
17 // values are calculated by assuming that you want the renderers to 17 // values are calculated by assuming that you want the renderers to
18 // use half of the installed ram and assuming that each tab uses 18 // use half of the installed ram and assuming that each tab uses
19 // ~25MB. 19 // ~40MB, however the curve is not linear but piecewise linear with
20 // interleaved slopes of 3 and 2.
21 // If you modify this table you need to adjust browser\browser_uitest.cc
22 // to match the expected number of processes.
23
20 static const int kMaxRenderersByRamTier[] = { 24 static const int kMaxRenderersByRamTier[] = {
21 4, // less than 256MB 25 3, // less than 256MB
22 8, // 256MB 26 6, // 256MB
23 12, // 512MB 27 9, // 512MB
24 16, // 768MB 28 12, // 768MB
29 14, // 1024MB
30 18, // 1280MB
31 20, // 1536MB
32 22, // 1792MB
33 24, // 2048MB
34 26, // 2304MB
35 29, // 2560MB
36 32, // 2816MB
37 35, // 3072MB
38 38, // 3328MB
39 40 // 3584MB
darin (slow to review) 2009/02/19 18:40:02 40 seems too high to me. can we just double our p
25 }; 40 };
26 41
27 static unsigned int max_count = 0; 42 static unsigned int max_count = 0;
28 if (!max_count) { 43 if (!max_count) {
29 size_t memory_tier = base::SysInfo::AmountOfPhysicalMemoryMB() / 256; 44 size_t memory_tier = base::SysInfo::AmountOfPhysicalMemoryMB() / 256;
30 if (memory_tier >= arraysize(kMaxRenderersByRamTier)) 45 if (memory_tier >= arraysize(kMaxRenderersByRamTier))
31 max_count = chrome::kMaxRendererProcessCount; 46 max_count = chrome::kMaxRendererProcessCount;
32 else 47 else
33 max_count = kMaxRenderersByRamTier[memory_tier]; 48 max_count = kMaxRenderersByRamTier[memory_tier];
34 } 49 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 166
152 return NULL; 167 return NULL;
153 } 168 }
154 169
155 void RenderProcessHost::Unregister() { 170 void RenderProcessHost::Unregister() {
156 if (host_id_ >= 0) { 171 if (host_id_ >= 0) {
157 all_hosts.Remove(host_id_); 172 all_hosts.Remove(host_id_);
158 host_id_ = -1; 173 host_id_ = -1;
159 } 174 }
160 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698