Chromium Code Reviews| Index: chrome/browser/experiments/memory_ablation_experiment.h |
| diff --git a/chrome/browser/experiments/memory_ablation_experiment.h b/chrome/browser/experiments/memory_ablation_experiment.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf98235ea8600af101529fd30b56d4dcd7fb494b |
| --- /dev/null |
| +++ b/chrome/browser/experiments/memory_ablation_experiment.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| +#define CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |
| + |
| +#include <stdlib.h> |
| + |
| +#include <memory> |
| + |
| +#include "base/feature_list.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/sequenced_task_runner.h" |
|
Primiano Tucci (use gerrit)
2017/04/10 18:05:04
can just forward declare this
DmitrySkiba
2017/04/10 19:31:00
Done.
|
| + |
| +extern const base::Feature kMemoryAblationFeature; |
| +extern const char kMemoryAblationFeatureSizeParam[]; |
| + |
| +/* When enabled, this experiment allocates a chunk of memory to study |
| + * correlation between memory usage and performance metrics. |
| + */ |
| +class MemoryAblationExperiment { |
| + public: |
| + ~MemoryAblationExperiment(); |
| + |
| + // Starts the experiment if corresponding field trial is enabled |
| + static void MaybeStart(scoped_refptr<base::SequencedTaskRunner> task_runner); |
| + |
| + private: |
| + MemoryAblationExperiment(); |
| + |
| + void Start(scoped_refptr<base::SequencedTaskRunner> task_runner, size_t size); |
| + |
| + void AllocateMemory(size_t size); |
| + void TouchMemory(); |
| + |
| + static MemoryAblationExperiment* GetInstance(); |
| + |
| + size_t memory_size_ = 0; |
| + std::unique_ptr<uint8_t[], decltype(free)*> memory_; |
|
Primiano Tucci (use gerrit)
2017/04/10 18:05:04
this one seems over-complicated for the need.
Can
DmitrySkiba
2017/04/10 19:31:00
Done.
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_ |