Commit 669c1693 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Crumbs: Flush file mapping on a blocking thread.

It appears blocking in-line with startup has a performance impact,
as some browser tests reliably time out with this in effect.

Bug: 620813
Change-Id: Ibfa722ce7a5062f6ae74d63fc59d8371af2645d9
Reviewed-on: https://chromium-review.googlesource.com/721462Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509469}
parent f19067d6
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/debug/activity_tracker.h" #include "base/debug/activity_tracker.h"
#include "base/feature_list.h" #include "base/feature_list.h"
...@@ -19,6 +21,7 @@ ...@@ -19,6 +21,7 @@
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/task_scheduler/post_task.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/prerender/prerender_field_trial.h" #include "chrome/browser/prerender/prerender_field_trial.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
...@@ -177,15 +180,18 @@ void SetupStabilityDebugging() { ...@@ -177,15 +180,18 @@ void SetupStabilityDebugging() {
// Trigger a flush of the memory mapped file to maximize the chances of // Trigger a flush of the memory mapped file to maximize the chances of
// having a minimal amount of content in the stability file, even if // having a minimal amount of content in the stability file, even if
// the system crashes or loses power. Note: this does not flush the file // the system crashes or loses power. Even running in the background,
// metadata nor does it wait for the changes to be flushed to disk before // this is a potentially expensive operation, so done under an experiment
// returning. This is an expensive operation. Run as an experiment to // to allow measuring the performance effects, if any.
// measure the effect on performance and collection.
const bool should_flush = base::GetFieldTrialParamByFeatureAsBool( const bool should_flush = base::GetFieldTrialParamByFeatureAsBool(
browser_watcher::kStabilityDebuggingFeature, browser_watcher::kStabilityDebuggingFeature,
browser_watcher::kInitFlushParam, false); browser_watcher::kInitFlushParam, false);
if (should_flush) if (should_flush) {
::FlushViewOfFile(global_tracker->allocator()->data(), 0U); base::PostTaskWithTraits(
FROM_HERE, {base::MayBlock()},
base::Bind(&base::PersistentMemoryAllocator::Flush,
base::Unretained(global_tracker->allocator()), true));
}
// Store a copy of the system profile in this allocator. There will be some // Store a copy of the system profile in this allocator. There will be some
// delay before this gets populated, perhaps as much as a minute. Because // delay before this gets populated, perhaps as much as a minute. Because
......
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