| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 // Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram | 217 // Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram |
| 218 // instance and thus only work if |name| is constant. | 218 // instance and thus only work if |name| is constant. |
| 219 base::HistogramBase* counter = base::SparseHistogram::FactoryGet( | 219 base::HistogramBase* counter = base::SparseHistogram::FactoryGet( |
| 220 name, base::HistogramBase::kUmaTargetedHistogramFlag); | 220 name, base::HistogramBase::kUmaTargetedHistogramFlag); |
| 221 counter->Add(sample); | 221 counter->Add(sample); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ExternalMetrics::CollectEvents() { | 224 void ExternalMetrics::CollectEvents() { |
| 225 const char* event_file_path = "/var/log/metrics/uma-events"; | 225 const char* event_file_path = "/var/run/metrics/uma-events"; |
| 226 struct stat stat_buf; | 226 struct stat stat_buf; |
| 227 int result; | 227 int result; |
| 228 if (!test_path_.empty()) { | 228 if (!test_path_.empty()) { |
| 229 event_file_path = test_path_.value().c_str(); | 229 event_file_path = test_path_.value().c_str(); |
| 230 } | 230 } |
| 231 result = stat(event_file_path, &stat_buf); | 231 result = stat(event_file_path, &stat_buf); |
| 232 if (result < 0) { | 232 if (result < 0) { |
| 233 if (errno != ENOENT) { | 233 if (errno != ENOENT) { |
| 234 DPLOG(ERROR) << event_file_path << ": bad metrics file stat"; | 234 DPLOG(ERROR) << event_file_path << ": bad metrics file stat"; |
| 235 } | 235 } |
| (...skipping 116 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 |