OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/oom_priority_manager.h" | 5 #include "chrome/browser/chromeos/oom_priority_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 using content::BrowserThread; | 44 using content::BrowserThread; |
45 using content::WebContents; | 45 using content::WebContents; |
46 | 46 |
47 namespace chromeos { | 47 namespace chromeos { |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 // Name of the experiment to run. | 51 // Name of the experiment to run. |
52 const char kExperiment[] = "LowMemoryMargin"; | 52 const char kExperiment[] = "LowMemoryMargin"; |
53 | 53 |
54 #define EXPERIMENT_CUSTOM_COUNTS(name, sample, min, max, buckets) \ | 54 #define EXPERIMENT_CUSTOM_COUNTS(name, sample, min, max, buckets) \ |
55 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, buckets); \ | 55 { \ |
56 if (base::FieldTrialList::TrialExists(kExperiment)) \ | 56 UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, buckets); \ |
57 UMA_HISTOGRAM_CUSTOM_COUNTS( \ | 57 if (base::FieldTrialList::TrialExists(kExperiment)) \ |
58 base::FieldTrial::MakeName(name, kExperiment), \ | 58 UMA_HISTOGRAM_CUSTOM_COUNTS( \ |
59 sample, min, max, buckets); | 59 base::FieldTrial::MakeName(name, kExperiment), \ |
| 60 sample, min, max, buckets); \ |
| 61 } |
60 | 62 |
61 // Record a size in megabytes, over a potential interval up to 32 GB. | 63 // Record a size in megabytes, over a potential interval up to 32 GB. |
62 #define EXPERIMENT_HISTOGRAM_MEGABYTES(name, sample) \ | 64 #define EXPERIMENT_HISTOGRAM_MEGABYTES(name, sample) \ |
63 EXPERIMENT_CUSTOM_COUNTS(name, sample, 1, 32768, 50) | 65 EXPERIMENT_CUSTOM_COUNTS(name, sample, 1, 32768, 50) |
64 | 66 |
65 // The default interval in seconds after which to adjust the oom_score_adj | 67 // The default interval in seconds after which to adjust the oom_score_adj |
66 // value. | 68 // value. |
67 const int kAdjustmentIntervalSeconds = 10; | 69 const int kAdjustmentIntervalSeconds = 10; |
68 | 70 |
69 // If there has been no priority adjustment in this interval, we assume the | 71 // If there has been no priority adjustment in this interval, we assume the |
70 // machine was suspended and correct our timing statistics. | 72 // machine was suspended and correct our timing statistics. |
71 const int kSuspendThresholdSeconds = kAdjustmentIntervalSeconds * 4; | 73 const int kSuspendThresholdSeconds = kAdjustmentIntervalSeconds * 4; |
72 | 74 |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore( | 496 content::ZygoteHost::GetInstance()->AdjustRendererOOMScore( |
495 iterator->renderer_handle, score); | 497 iterator->renderer_handle, score); |
496 pid_to_oom_score_[iterator->renderer_handle] = score; | 498 pid_to_oom_score_[iterator->renderer_handle] = score; |
497 } | 499 } |
498 priority += priority_increment; | 500 priority += priority_increment; |
499 } | 501 } |
500 } | 502 } |
501 } | 503 } |
502 | 504 |
503 } // namespace chromeos | 505 } // namespace chromeos |
OLD | NEW |