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 17 matching lines...) Expand all Loading... | |
28 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
29 | 29 |
30 using content::BrowserThread; | 30 using content::BrowserThread; |
31 using content::UserMetricsAction; | 31 using content::UserMetricsAction; |
32 | 32 |
33 namespace chromeos { | 33 namespace chromeos { |
34 | 34 |
35 // The interval between external metrics collections in seconds | 35 // The interval between external metrics collections in seconds |
36 static const int kExternalMetricsCollectionIntervalSeconds = 30; | 36 static const int kExternalMetricsCollectionIntervalSeconds = 30; |
37 | 37 |
38 class SystemHistogram : public base::Histogram { | 38 class SystemHistogram { |
zel
2012/10/24 01:11:00
You can get rid of this class now and just expose
kaiwang
2012/10/24 03:43:28
Done.
| |
39 public: | 39 public: |
40 static bool CheckValues(const std::string& name, | 40 static bool CheckValues(const std::string& name, |
41 int minimum, | 41 int minimum, |
42 int maximum, | 42 int maximum, |
43 size_t bucket_count) { | 43 size_t bucket_count) { |
44 if (!base::Histogram::InspectConstructionArguments( | 44 if (!base::Histogram::InspectConstructionArguments( |
45 name, &minimum, &maximum, &bucket_count)) | 45 name, &minimum, &maximum, &bucket_count)) |
46 return false; | 46 return false; |
47 Histogram* histogram = base::StatisticsRecorder::FindHistogram(name); | 47 HistogramBase* histogram = base::StatisticsRecorder::FindHistogram(name); |
48 if (!histogram) | 48 if (!histogram) |
49 return true; | 49 return true; |
50 return histogram->HasConstructionArguments(minimum, maximum, bucket_count); | 50 return histogram->HasConstructionArguments(minimum, maximum, bucket_count); |
51 } | 51 } |
52 static bool CheckLinearValues(const std::string& name, int maximum) { | 52 static bool CheckLinearValues(const std::string& name, int maximum) { |
53 return CheckValues(name, 1, maximum, maximum + 1); | 53 return CheckValues(name, 1, maximum, maximum + 1); |
54 } | 54 } |
55 }; | 55 }; |
56 | 56 |
57 ExternalMetrics::ExternalMetrics() | 57 ExternalMetrics::ExternalMetrics() |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 void ExternalMetrics::ScheduleCollector() { | 266 void ExternalMetrics::ScheduleCollector() { |
267 bool result; | 267 bool result; |
268 result = BrowserThread::PostDelayedTask( | 268 result = BrowserThread::PostDelayedTask( |
269 BrowserThread::FILE, FROM_HERE, | 269 BrowserThread::FILE, FROM_HERE, |
270 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), | 270 base::Bind(&chromeos::ExternalMetrics::CollectEventsAndReschedule, this), |
271 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); | 271 base::TimeDelta::FromSeconds(kExternalMetricsCollectionIntervalSeconds)); |
272 DCHECK(result); | 272 DCHECK(result); |
273 } | 273 } |
274 | 274 |
275 } // namespace chromeos | 275 } // namespace chromeos |
OLD | NEW |