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

Side by Side Diff: base/metrics/field_trial.cc

Issue 2666653002: Record field-trial information in stability file for crash analysis. (Closed)
Patch Set: addressed review comments by manzagop Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/metrics/field_trial.h" 5 #include "base/metrics/field_trial.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
11 #include "base/build_time.h" 11 #include "base/build_time.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/activity_tracker.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/metrics/field_trial_param_associator.h" 15 #include "base/metrics/field_trial_param_associator.h"
15 #include "base/process/memory.h" 16 #include "base/process/memory.h"
16 #include "base/rand_util.h" 17 #include "base/rand_util.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
21 22
22 // On POSIX, the fd is shared using the mapping in GlobalDescriptors. 23 // On POSIX, the fd is shared using the mapping in GlobalDescriptors.
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return; 976 return;
976 field_trial->group_reported_ = true; 977 field_trial->group_reported_ = true;
977 978
978 if (!field_trial->enable_field_trial_) 979 if (!field_trial->enable_field_trial_)
979 return; 980 return;
980 981
981 if (kUseSharedMemoryForFieldTrials) 982 if (kUseSharedMemoryForFieldTrials)
982 ActivateFieldTrialEntryWhileLocked(field_trial); 983 ActivateFieldTrialEntryWhileLocked(field_trial);
983 } 984 }
984 985
986 // Recording for stability debugging has to be done inline as a task posted
987 // to an observer may not get executed before a crash.
Alexei Svitkine (slow) 2017/02/06 17:46:12 While you're changing this, how about setting cras
manzagop (departed) 2017/02/06 18:38:16 IIUC the problem with crash keys is the update lea
bcwhite 2017/02/07 15:58:58 Happy to do it, if it's desired, but I'll do it as
988 base::debug::GlobalActivityTracker::RecordFieldTrial(
Alexei Svitkine (slow) 2017/02/06 17:46:12 Is this API thread safe? Because this can be calle
bcwhite 2017/02/07 15:58:59 Yes. Done.
989 field_trial->trial_name(), field_trial->group_name_internal());
990
985 global_->observer_list_->Notify( 991 global_->observer_list_->Notify(
986 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized, 992 FROM_HERE, &FieldTrialList::Observer::OnFieldTrialGroupFinalized,
987 field_trial->trial_name(), field_trial->group_name_internal()); 993 field_trial->trial_name(), field_trial->group_name_internal());
988 } 994 }
989 995
990 // static 996 // static
991 size_t FieldTrialList::GetFieldTrialCount() { 997 size_t FieldTrialList::GetFieldTrialCount() {
992 if (!global_) 998 if (!global_)
993 return 0; 999 return 0;
994 AutoLock auto_lock(global_->lock_); 1000 AutoLock auto_lock(global_->lock_);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 return; 1353 return;
1348 } 1354 }
1349 AutoLock auto_lock(global_->lock_); 1355 AutoLock auto_lock(global_->lock_);
1350 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name(); 1356 CHECK(!global_->PreLockedFind(trial->trial_name())) << trial->trial_name();
1351 trial->AddRef(); 1357 trial->AddRef();
1352 trial->SetTrialRegistered(); 1358 trial->SetTrialRegistered();
1353 global_->registered_[trial->trial_name()] = trial; 1359 global_->registered_[trial->trial_name()] = trial;
1354 } 1360 }
1355 1361
1356 } // namespace base 1362 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698