Commit cc7f6c23 authored by Brian White's avatar Brian White Committed by Commit Bot

Disable mapped-file persistent metrics on low-end devices.

Also, reduce file size from 8MB to 4MB because that's what is reported
by the most recent metrics indicate.  And remove a block of obsolete
code doing an unnecessary disk access.

Bug: 896394
Change-Id: I8830fce2f467044550d5f01597ae5d1a998689f4
Reviewed-on: https://chromium-review.googlesource.com/c/1294293Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Reviewed-by: default avatarAlexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Peter Wen <wnwen@chromium.org>
Commit-Queue: Brian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602352}
parent ff416310
...@@ -87,17 +87,6 @@ void InstantiatePersistentHistograms() { ...@@ -87,17 +87,6 @@ void InstantiatePersistentHistograms() {
metrics_dir, upload_dir, ChromeMetricsServiceClient::kBrowserMetricsName, metrics_dir, upload_dir, ChromeMetricsServiceClient::kBrowserMetricsName,
&upload_file, &active_file, &spare_file); &upload_file, &active_file, &spare_file);
// The "active" file isn't used any longer. Metics are stored directly into
// the "upload" file and a run-time filter prevents its upload as long as the
// process that created it still lives.
// TODO(bcwhite): Remove this in M65 or later.
base::PostTaskWithTraits(
FROM_HERE,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(base::IgnoreResult(&base::DeleteFile),
std::move(active_file), /*recursive=*/false));
// This is used to report results to an UMA histogram. // This is used to report results to an UMA histogram.
enum InitResult { enum InitResult {
LOCAL_MEMORY_SUCCESS, LOCAL_MEMORY_SUCCESS,
...@@ -113,9 +102,9 @@ void InstantiatePersistentHistograms() { ...@@ -113,9 +102,9 @@ void InstantiatePersistentHistograms() {
// Create persistent/shared memory and allow histograms to be stored in // Create persistent/shared memory and allow histograms to be stored in
// it. Memory that is not actualy used won't be physically mapped by the // it. Memory that is not actualy used won't be physically mapped by the
// system. BrowserMetrics usage, as reported in UMA, has the 99.9 percentile // system. BrowserMetrics usage, as reported in UMA, has the 99.99
// around 4MiB as of 2017-02-16. // percentile around 3MiB as of 2018-10-22.
const size_t kAllocSize = 8 << 20; // 8 MiB const size_t kAllocSize = 4 << 20; // 4 MiB
const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics) const uint32_t kAllocId = 0x935DDD43; // SHA1(BrowserMetrics)
std::string storage = variations::GetVariationParamValueByFeature( std::string storage = variations::GetVariationParamValueByFeature(
base::kPersistentHistogramsFeature, "storage"); base::kPersistentHistogramsFeature, "storage");
...@@ -135,6 +124,12 @@ void InstantiatePersistentHistograms() { ...@@ -135,6 +124,12 @@ void InstantiatePersistentHistograms() {
} }
#endif #endif
// Don't use mapped-file memory by default on low-end devices, especially
// on Android. The extra disk consumption and/or extra disk access could
// have a significant performance impact. https://crbug.com/896394
if (storage.empty() && base::SysInfo::IsLowEndDevice())
storage = kLocalMemory;
if (storage.empty() || storage == kMappedFile) { if (storage.empty() || storage == kMappedFile) {
if (!base::PathExists(upload_dir)) { if (!base::PathExists(upload_dir)) {
// Handle failure to create the directory. // Handle failure to create the directory.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment