OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file contains macros to simplify histogram reporting from the disk | 5 // This file contains macros to simplify histogram reporting from the disk |
6 // cache. The main issue is that we want to have separate histograms for each | 6 // cache. The main issue is that we want to have separate histograms for each |
7 // type of cache (regular vs. media, etc), without adding the complexity of | 7 // type of cache (regular vs. media, etc), without adding the complexity of |
8 // keeping track of a potentially large number of histogram objects that have to | 8 // keeping track of a potentially large number of histogram objects that have to |
9 // survive the backend object that created them. | 9 // survive the backend object that created them. |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #define CACHE_HISTOGRAM_COUNTS(name, sample) CACHE_HISTOGRAM_CUSTOM_COUNTS( \ | 29 #define CACHE_HISTOGRAM_COUNTS(name, sample) CACHE_HISTOGRAM_CUSTOM_COUNTS( \ |
30 name, sample, 1, 1000000, 50) | 30 name, sample, 1, 1000000, 50) |
31 | 31 |
32 #define CACHE_HISTOGRAM_COUNTS_10000(name, sample) \ | 32 #define CACHE_HISTOGRAM_COUNTS_10000(name, sample) \ |
33 CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50) | 33 CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50) |
34 | 34 |
35 #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ | 35 #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ |
36 do { \ | 36 do { \ |
37 static scoped_refptr<Histogram> counter; \ | 37 static scoped_refptr<Histogram> counter; \ |
38 if (!counter || name != counter->histogram_name()) \ | 38 if (!counter || name != counter->histogram_name()) \ |
39 counter = Histogram::FactoryGet(name, min, max, bucket_count, \ | 39 counter = Histogram::FactoryTimeGet(name, min, max, bucket_count, \ |
40 Histogram::kUmaTargetedHistogramFlag); \ | 40 Histogram::kUmaTargetedHistogramFlag); \ |
41 counter->AddTime(sample); \ | 41 counter->AddTime(sample); \ |
42 } while (0) | 42 } while (0) |
43 | 43 |
44 #define CACHE_HISTOGRAM_TIMES(name, sample) CACHE_HISTOGRAM_CUSTOM_TIMES( \ | 44 #define CACHE_HISTOGRAM_TIMES(name, sample) CACHE_HISTOGRAM_CUSTOM_TIMES( \ |
45 name, sample, base::TimeDelta::FromMilliseconds(1), \ | 45 name, sample, base::TimeDelta::FromMilliseconds(1), \ |
46 base::TimeDelta::FromSeconds(10), 50) | 46 base::TimeDelta::FromSeconds(10), 50) |
47 | 47 |
48 #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ | 48 #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ |
49 static scoped_refptr<Histogram> counter; \ | 49 static scoped_refptr<Histogram> counter; \ |
50 if (!counter || name != counter->histogram_name()) \ | 50 if (!counter || name != counter->histogram_name()) \ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 case net::APP_CACHE:\ | 104 case net::APP_CACHE:\ |
105 CACHE_HISTOGRAM_##type(my_name.data(), sample);\ | 105 CACHE_HISTOGRAM_##type(my_name.data(), sample);\ |
106 break;\ | 106 break;\ |
107 default:\ | 107 default:\ |
108 NOTREACHED();\ | 108 NOTREACHED();\ |
109 break;\ | 109 break;\ |
110 }\ | 110 }\ |
111 } | 111 } |
112 | 112 |
113 #endif // NET_DISK_CACHE_HISTOGRAM_MACROS_H_ | 113 #endif // NET_DISK_CACHE_HISTOGRAM_MACROS_H_ |
OLD | NEW |