| OLD | NEW |
| 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 "chrome/browser/chromeos/external_metrics.h" | 5 #include "chrome/browser/chromeos/external_metrics.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Announce the experiment to any listeners (especially important is the UMA | 84 // Announce the experiment to any listeners (especially important is the UMA |
| 85 // software, which will append the group names to UMA statistics). | 85 // software, which will append the group names to UMA statistics). |
| 86 const int group_num = trial->group(); | 86 const int group_num = trial->group(); |
| 87 std::string group_char = "x"; | 87 std::string group_char = "x"; |
| 88 if (ContainsKey(group_to_char, group_num)) | 88 if (ContainsKey(group_to_char, group_num)) |
| 89 group_char = group_to_char[group_num]; | 89 group_char = group_to_char[group_num]; |
| 90 | 90 |
| 91 // Write the group to the file to be read by ChromeOS. | 91 // Write the group to the file to be read by ChromeOS. |
| 92 int size = static_cast<int>(group_char.length()); | 92 int size = static_cast<int>(group_char.length()); |
| 93 if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) { | 93 if (file_util::WriteFile(group_file_path, group_char.c_str(), size) == size) { |
| 94 LOG(INFO) << "Configured in group '" << trial->group_name() | 94 VLOG(1) << "Configured in group '" << trial->group_name() |
| 95 << "' ('" << group_char << "') for " | 95 << "' ('" << group_char << "') for " |
| 96 << name_of_experiment << " field trial"; | 96 << name_of_experiment << " field trial"; |
| 97 } else { | 97 } else { |
| 98 LOG(ERROR) << "Couldn't write to " << group_file_path.value(); | 98 LOG(ERROR) << "Couldn't write to " << group_file_path.value(); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace | 102 } // namespace |
| 103 | 103 |
| 104 // The interval between external metrics collections in seconds | 104 // The interval between external metrics collections in seconds |
| 105 static const int kExternalMetricsCollectionIntervalSeconds = 30; | 105 static const int kExternalMetricsCollectionIntervalSeconds = 30; |
| 106 | 106 |
| 107 ExternalMetrics::ExternalMetrics() : test_recorder_(NULL) {} | 107 ExternalMetrics::ExternalMetrics() : test_recorder_(NULL) {} |
| 108 | 108 |
| 109 ExternalMetrics::~ExternalMetrics() {} | 109 ExternalMetrics::~ExternalMetrics() {} |
| 110 | 110 |
| 111 void ExternalMetrics::Start() { | 111 void ExternalMetrics::Start() { |
| 112 // Register user actions external to the browser. | 112 // Register user actions external to the browser. |
| 113 // chrome/tools/extract_actions.py won't understand these lines, so all of | 113 // tools/metrics/actions/extract_actions.py won't understand these lines, so |
| 114 // these are explicitly added in that script. | 114 // all of these are explicitly added in that script. |
| 115 // TODO(derat): We shouldn't need to verify actions before reporting them; | 115 // TODO(derat): We shouldn't need to verify actions before reporting them; |
| 116 // remove all of this once http://crosbug.com/11125 is fixed. | 116 // remove all of this once http://crosbug.com/11125 is fixed. |
| 117 valid_user_actions_.insert("Cryptohome.PKCS11InitFail"); | 117 valid_user_actions_.insert("Cryptohome.PKCS11InitFail"); |
| 118 valid_user_actions_.insert("Updater.ServerCertificateChanged"); | 118 valid_user_actions_.insert("Updater.ServerCertificateChanged"); |
| 119 valid_user_actions_.insert("Updater.ServerCertificateFailed"); | 119 valid_user_actions_.insert("Updater.ServerCertificateFailed"); |
| 120 | 120 |
| 121 // Initialize here field trials that don't need to read from files. | 121 // Initialize here field trials that don't need to read from files. |
| 122 // (None for the moment.) | 122 // (None for the moment.) |
| 123 | 123 |
| 124 // Initialize any chromeos field trials that need to read from a file (e.g., | 124 // Initialize any chromeos field trials that need to read from a file (e.g., |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 void ExternalMetrics::SetupFieldTrialsOnFileThread() { | 352 void ExternalMetrics::SetupFieldTrialsOnFileThread() { |
| 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 353 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 354 // Field trials that do not read from files can be initialized in | 354 // Field trials that do not read from files can be initialized in |
| 355 // ExternalMetrics::Start() above. | 355 // ExternalMetrics::Start() above. |
| 356 SetupProgressiveScanFieldTrial(); | 356 SetupProgressiveScanFieldTrial(); |
| 357 | 357 |
| 358 ScheduleCollector(); | 358 ScheduleCollector(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace chromeos | 361 } // namespace chromeos |
| OLD | NEW |