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

Side by Side Diff: chrome/browser/experiments/memory_ablation_experiment.h

Issue 2810833002: Add memory ablation experiment. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
(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 <stdlib.h>
9
10 #include <memory>
11
12 #include "base/feature_list.h"
13 #include "base/memory/ref_counted.h"
14 #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.
15
16 extern const base::Feature kMemoryAblationFeature;
17 extern const char kMemoryAblationFeatureSizeParam[];
18
19 /* When enabled, this experiment allocates a chunk of memory to study
20 * correlation between memory usage and performance metrics.
21 */
22 class MemoryAblationExperiment {
23 public:
24 ~MemoryAblationExperiment();
25
26 // Starts the experiment if corresponding field trial is enabled
27 static void MaybeStart(scoped_refptr<base::SequencedTaskRunner> task_runner);
28
29 private:
30 MemoryAblationExperiment();
31
32 void Start(scoped_refptr<base::SequencedTaskRunner> task_runner, size_t size);
33
34 void AllocateMemory(size_t size);
35 void TouchMemory();
36
37 static MemoryAblationExperiment* GetInstance();
38
39 size_t memory_size_ = 0;
40 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.
41 };
42
43 #endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698