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

Side by Side Diff: chrome/browser/chrome_browser_field_trials_desktop.cc

Issue 1980743002: Track thread activities in order to diagnose hangs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@readwrite-mmf
Patch Set: rebased Created 4 years, 4 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
« no previous file with comments | « base/threading/platform_thread_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_field_trials_desktop.h" 5 #include "chrome/browser/chrome_browser_field_trials_desktop.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/activity_tracker.h"
11 #include "base/feature_list.h"
10 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/path_service.h"
11 #include "chrome/browser/prerender/prerender_field_trial.h" 14 #include "chrome/browser/prerender/prerender_field_trial.h"
15 #include "chrome/common/chrome_paths.h"
12 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/variations/variations_util.h" 17 #include "chrome/common/variations/variations_util.h"
14 #include "components/variations/variations_associated_data.h" 18 #include "components/variations/variations_associated_data.h"
15 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
16 20
17 namespace chrome { 21 namespace chrome {
18 22
19 namespace { 23 namespace {
20 24
25 const base::Feature kStabilityDebuggingFeature{
26 "StabilityDebugging", base::FEATURE_DISABLED_BY_DEFAULT
27 };
28
21 void SetupStunProbeTrial() { 29 void SetupStunProbeTrial() {
22 #if defined(ENABLE_WEBRTC) 30 #if defined(ENABLE_WEBRTC)
23 std::map<std::string, std::string> params; 31 std::map<std::string, std::string> params;
24 if (!variations::GetVariationParams("StunProbeTrial2", &params)) 32 if (!variations::GetVariationParams("StunProbeTrial2", &params))
25 return; 33 return;
26 34
27 // The parameter, used by StartStunFieldTrial, should have the following 35 // The parameter, used by StartStunFieldTrial, should have the following
28 // format: "request_per_ip/interval/sharedsocket/batch_size/total_batches/ 36 // format: "request_per_ip/interval/sharedsocket/batch_size/total_batches/
29 // server1:port/server2:port/server3:port/" 37 // server1:port/server2:port/server3:port/"
30 std::string cmd_param = params["request_per_ip"] + "/" + params["interval"] + 38 std::string cmd_param = params["request_per_ip"] + "/" + params["interval"] +
31 "/" + params["sharedsocket"] + "/" + 39 "/" + params["sharedsocket"] + "/" +
32 params["batch_size"] + "/" + params["total_batches"] + 40 params["batch_size"] + "/" + params["total_batches"] +
33 "/" + params["server1"] + "/" + params["server2"] + 41 "/" + params["server1"] + "/" + params["server2"] +
34 "/" + params["server3"] + "/" + params["server4"] + 42 "/" + params["server3"] + "/" + params["server4"] +
35 "/" + params["server5"] + "/" + params["server6"]; 43 "/" + params["server5"] + "/" + params["server6"];
36 44
37 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 45 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
38 switches::kWebRtcStunProbeTrialParameter, cmd_param); 46 switches::kWebRtcStunProbeTrialParameter, cmd_param);
39 #endif 47 #endif
40 } 48 }
41 49
50 void SetupStabilityDebugging() {
51 if (!base::FeatureList::IsEnabled(kStabilityDebuggingFeature))
52 return;
53
54 // TODO(bcwhite): Adjust these numbers once there is real data to show
55 // just how much of an arena is necessary.
56 const size_t kMemorySize = 1 << 20; // 1 MiB
57 const int kStackDepth = 4;
58 const uint64_t kAllocatorId = 0;
59
60 // Track code activities (such as posting task, blocking on locks, and
61 // joining threads) that can cause hanging threads and general instability.
62 base::FilePath user_data_dir;
63 bool success = base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
64 DCHECK(success);
65 base::debug::GlobalActivityTracker::CreateWithFile(
66 user_data_dir
67 .AppendASCII("StabilityDebugInfo")
68 .AddExtension(base::PersistentMemoryAllocator::kFileExtension),
69 kMemorySize, kAllocatorId, kStabilityDebuggingFeature.name, kStackDepth);
70 }
71
42 } // namespace 72 } // namespace
43 73
44 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) { 74 void SetupDesktopFieldTrials(const base::CommandLine& parsed_command_line) {
45 prerender::ConfigurePrerender(parsed_command_line); 75 prerender::ConfigurePrerender(parsed_command_line);
46 SetupStunProbeTrial(); 76 SetupStunProbeTrial();
77 SetupStabilityDebugging();
47 } 78 }
48 79
49 } // namespace chrome 80 } // namespace chrome
OLDNEW
« no previous file with comments | « base/threading/platform_thread_win.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698