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

Unified Diff: base/metrics/field_trial.cc

Issue 2490513004: Bump field trial allocator size to 64kb and report usage (Closed)
Patch Set: Add ifdef for unused variable Created 4 years, 1 month 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/field_trial.cc
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc
index 63f549e5729d69b3587de96dbef7ad61764bac26..65611e3fc5fd220a1ba1dcda7ebaeeb04c776b8b 100644
--- a/base/metrics/field_trial.cc
+++ b/base/metrics/field_trial.cc
@@ -43,8 +43,12 @@ const bool kUseSharedMemoryForFieldTrials = false;
// Constants for the field trial allocator.
const char kAllocatorName[] = "FieldTrialAllocator";
const uint32_t kFieldTrialType = 0xABA17E13 + 1; // SHA1(FieldTrialEntry) v1
bcwhite 2016/11/08 20:30:02 Blank line after.
lawrencewu 2016/11/09 18:06:46 Done.
+// We allocate 64 KiB to hold all the field trial data. This should be enough,
bcwhite 2016/11/08 20:30:02 Include the date when this was true. Also, commen
lawrencewu 2016/11/09 18:06:46 Done.
+// as currently we use ~8KiB for the field trials, and ~10KiB for experiment
+// parameters. This also doesn't allocate all 64 KiB at once -- the pages only
+// get mapped to physical memory when they are touched.
#if !defined(OS_NACL)
-const size_t kFieldTrialAllocationSize = 4 << 10; // 4 KiB = one page
+const size_t kFieldTrialAllocationSize = 4 << 14;
bcwhite 2016/11/08 20:14:32 Please do this as 64 << 10 // 64 KiB
lawrencewu 2016/11/09 18:06:46 Done.
#endif
// We create one FieldTrialEntry per field trial in shared memory, via
@@ -179,6 +183,15 @@ HANDLE CreateReadOnlyHandle(SharedPersistentMemoryAllocator* allocator) {
return nullptr;
return dst;
}
+
+void ReportFieldTrialAllocatorUsage(
bcwhite 2016/11/08 20:14:32 Don't need this.
lawrencewu 2016/11/09 18:06:46 Removed.
+ SharedPersistentMemoryAllocator* allocator) {
+ size_t used = allocator->used();
+ UMA_HISTOGRAM_COUNTS_100000("UMA.FieldTrialAllocator.Used", used);
+ int used_percent = used / kFieldTrialAllocationSize;
+ UMA_HISTOGRAM_PERCENTAGE("UMA.FieldTrialAllocator.UsedPct",
+ used_percent * 100);
+}
#endif
} // namespace
@@ -728,8 +741,7 @@ void FieldTrialList::CopyFieldTrialStateToFlags(
std::to_string(field_trial_length);
cmd_line->AppendSwitchASCII(field_trial_handle_switch, field_trial_handle);
- UMA_HISTOGRAM_COUNTS_10000("UMA.FieldTrialAllocator.Size",
- field_trial_length);
+ ReportFieldTrialAllocatorUsage(global_->field_trial_allocator_.get());
bcwhite 2016/11/08 20:14:32 When you create the allocator, call allocator->Cr
lawrencewu 2016/11/09 18:06:46 Done. But this will get called on every subprocess
bcwhite 2016/11/09 18:57:37 Not ideal but acceptable. If you can call it once
lawrencewu 2016/11/09 19:15:00 Acknowledged.
return;
}
#endif
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698