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

Unified Diff: chrome/browser/experiments/memory_ablation_experiment.h

Issue 2810833002: Add memory ablation experiment. (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/experiments/memory_ablation_experiment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..146c1ca3f66f3da5f43e26f9254036a2ee6b5f18
--- /dev/null
+++ b/chrome/browser/experiments/memory_ablation_experiment.h
@@ -0,0 +1,44 @@
+// 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 <memory>
+
+#include "base/feature_list.h"
+#include "base/memory/ref_counted.h"
+
+namespace base {
+class SequencedTaskRunner;
+}
+
+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[]> memory_;
+};
+
+#endif // CHROME_BROWSER_EXPERIMENTS_MEMORY_ABLATION_EXPERIMENT_H_
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/experiments/memory_ablation_experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698