OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| 6 #define CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/feature_list.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 |
| 13 namespace base { |
| 14 class SequencedTaskRunner; |
| 15 } |
| 16 |
| 17 extern const base::Feature kMemoryAblationFeature; |
| 18 extern const char kMemoryAblationFeatureSizeParam[]; |
| 19 |
| 20 /* When enabled, this experiment allocates a chunk of memory to study |
| 21 * correlation between memory usage and performance metrics. |
| 22 */ |
| 23 class MemoryAblationExperiment { |
| 24 public: |
| 25 ~MemoryAblationExperiment(); |
| 26 |
| 27 // Starts the experiment if corresponding field trial is enabled |
| 28 static void MaybeStart(scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 29 |
| 30 private: |
| 31 MemoryAblationExperiment(); |
| 32 |
| 33 void Start(scoped_refptr<base::SequencedTaskRunner> task_runner, size_t size); |
| 34 |
| 35 void AllocateMemory(size_t size); |
| 36 void TouchMemory(); |
| 37 |
| 38 static MemoryAblationExperiment* GetInstance(); |
| 39 |
| 40 size_t memory_size_ = 0; |
| 41 std::unique_ptr<uint8_t[]> memory_; |
| 42 }; |
| 43 |
| 44 #endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
OLD | NEW |