OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/metrics/metrics_service.h" | 25 #include "chrome/browser/metrics/metrics_service.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/user_metrics.h" | 27 #include "content/public/browser/user_metrics.h" |
28 | 28 |
29 using content::BrowserThread; | 29 using content::BrowserThread; |
30 using content::UserMetricsAction; | 30 using content::UserMetricsAction; |
31 | 31 |
32 namespace chromeos { | 32 namespace chromeos { |
33 | 33 |
34 // The interval between external metrics collections, in milliseconds. | 34 // The interval between external metrics collections in seconds |
35 static const int kExternalMetricsCollectionIntervalMs = 30 * 1000; | 35 static const int kExternalMetricsCollectionIntervalSeconds = 30; |
36 | 36 |
37 ExternalMetrics::ExternalMetrics() | 37 ExternalMetrics::ExternalMetrics() |
38 : test_recorder_(NULL) { | 38 : test_recorder_(NULL) { |
39 } | 39 } |
40 | 40 |
41 ExternalMetrics::~ExternalMetrics() {} | 41 ExternalMetrics::~ExternalMetrics() {} |
42 | 42 |
43 void ExternalMetrics::Start() { | 43 void ExternalMetrics::Start() { |
44 // Register user actions external to the browser. | 44 // Register user actions external to the browser. |
45 // chrome/tools/extract_actions.py won't understand these lines, so all of | 45 // chrome/tools/extract_actions.py won't understand these lines, so all of |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 CollectEvents(); | 233 CollectEvents(); |
234 UMA_HISTOGRAM_TIMES("UMA.CollectExternalEventsTime", timer.Elapsed()); | 234 UMA_HISTOGRAM_TIMES("UMA.CollectExternalEventsTime", timer.Elapsed()); |
235 ScheduleCollector(); | 235 ScheduleCollector(); |
236 } | 236 } |
237 | 237 |
238 void ExternalMetrics::ScheduleCollector() { | 238 void ExternalMetrics::ScheduleCollector() { |
239 bool result; | 239 bool result; |
240 result = BrowserThread::PostDelayedTask( | 240 result = BrowserThread::PostDelayedTask( |
241 BrowserThread::FILE, FROM_HERE, | 241 BrowserThread::FILE, FROM_HERE, |
242 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), | 242 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), |
243 kExternalMetricsCollectionIntervalMs); | 243 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); |
244 DCHECK(result); | 244 DCHECK(result); |
245 } | 245 } |
246 | 246 |
247 } // namespace chromeos | 247 } // namespace chromeos |
OLD | NEW |