Remove Google Now Enable/Disable Flag
[chromium-blink-merge.git] / sync / util / data_type_histogram.h
blobe2ab49fe849d7a17b4d227655226f5de602281e8
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
3 // found in the LICENSE file.
5 #ifndef SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_
6 #define SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_
8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h"
10 #include "sync/internal_api/public/base/model_type.h"
12 // For now, this just implements UMA_HISTOGRAM_LONG_TIMES. This can be adjusted
13 // if we feel the min, max, or bucket count amount are not appropriate.
14 #define SYNC_FREQ_HISTOGRAM(name, time) UMA_HISTOGRAM_CUSTOM_TIMES( \
15 name, time, base::TimeDelta::FromMilliseconds(1), \
16 base::TimeDelta::FromHours(1), 50)
18 // Helper macro for datatype specific histograms. For each datatype, invokes
19 // a pre-defined PER_DATA_TYPE_MACRO(type_str), where |type_str| is the string
20 // version of the datatype.
22 // Example usage (ignoring newlines necessary for multiline macro):
23 // std::vector<syncer::ModelType> types = GetEntryTypes();
24 // for (int i = 0; i < types.size(); ++i) {
25 // #define PER_DATA_TYPE_MACRO(type_str)
26 // UMA_HISTOGRAM_ENUMERATION("Sync." type_str "StartFailures",
27 // error, max_error);
28 // SYNC_DATA_TYPE_HISTOGRAM(types[i]);
29 // #undef PER_DATA_TYPE_MACRO
30 // }
32 // TODO(zea): Once visual studio supports proper variadic argument replacement
33 // in macros, pass in the histogram method directly as a parameter.
34 // See http://connect.microsoft.com/VisualStudio/feedback/details/380090/
35 // variadic-macro-replacement#details
36 #define SYNC_DATA_TYPE_HISTOGRAM(datatype) \
37 do { \
38 switch (datatype) { \
39 case ::syncer::BOOKMARKS: \
40 PER_DATA_TYPE_MACRO("Bookmarks"); \
41 break; \
42 case ::syncer::PREFERENCES: \
43 PER_DATA_TYPE_MACRO("Preferences"); \
44 break; \
45 case ::syncer::PASSWORDS: \
46 PER_DATA_TYPE_MACRO("Passwords"); \
47 break; \
48 case ::syncer::AUTOFILL: \
49 PER_DATA_TYPE_MACRO("Autofill"); \
50 break; \
51 case ::syncer::AUTOFILL_PROFILE: \
52 PER_DATA_TYPE_MACRO("AutofillProfiles"); \
53 break; \
54 case ::syncer::THEMES: \
55 PER_DATA_TYPE_MACRO("Themes"); \
56 break; \
57 case ::syncer::TYPED_URLS: \
58 PER_DATA_TYPE_MACRO("TypedUrls"); \
59 break; \
60 case ::syncer::EXTENSIONS: \
61 PER_DATA_TYPE_MACRO("Extensions"); \
62 break; \
63 case ::syncer::NIGORI: \
64 PER_DATA_TYPE_MACRO("Nigori"); \
65 break; \
66 case ::syncer::SEARCH_ENGINES: \
67 PER_DATA_TYPE_MACRO("SearchEngines"); \
68 break; \
69 case ::syncer::SESSIONS: \
70 PER_DATA_TYPE_MACRO("Sessions"); \
71 break; \
72 case ::syncer::APPS: \
73 PER_DATA_TYPE_MACRO("Apps"); \
74 break; \
75 case ::syncer::APP_LIST: \
76 PER_DATA_TYPE_MACRO("AppList"); \
77 break; \
78 case ::syncer::APP_SETTINGS: \
79 PER_DATA_TYPE_MACRO("AppSettings"); \
80 break; \
81 case ::syncer::EXTENSION_SETTINGS: \
82 PER_DATA_TYPE_MACRO("ExtensionSettings"); \
83 break; \
84 case ::syncer::APP_NOTIFICATIONS: \
85 PER_DATA_TYPE_MACRO("AppNotifications"); \
86 break; \
87 case ::syncer::HISTORY_DELETE_DIRECTIVES: \
88 PER_DATA_TYPE_MACRO("HistoryDeleteDirectives"); \
89 break; \
90 case ::syncer::SYNCED_NOTIFICATIONS: \
91 PER_DATA_TYPE_MACRO("SyncedNotifications"); \
92 break; \
93 case ::syncer::SYNCED_NOTIFICATION_APP_INFO: \
94 PER_DATA_TYPE_MACRO("SyncedNotificationAppInfo"); \
95 break; \
96 case ::syncer::DEVICE_INFO: \
97 PER_DATA_TYPE_MACRO("DeviceInfo"); \
98 break; \
99 case ::syncer::EXPERIMENTS: \
100 PER_DATA_TYPE_MACRO("Experiments"); \
101 break; \
102 case ::syncer::PRIORITY_PREFERENCES :\
103 PER_DATA_TYPE_MACRO("PriorityPreferences"); \
104 break; \
105 case ::syncer::DICTIONARY: \
106 PER_DATA_TYPE_MACRO("Dictionary"); \
107 break; \
108 case ::syncer::FAVICON_IMAGES: \
109 PER_DATA_TYPE_MACRO("FaviconImages"); \
110 break; \
111 case ::syncer::FAVICON_TRACKING: \
112 PER_DATA_TYPE_MACRO("FaviconTracking"); \
113 break; \
114 case ::syncer::MANAGED_USER_SETTINGS: \
115 PER_DATA_TYPE_MACRO("ManagedUserSetting"); \
116 break; \
117 case ::syncer::MANAGED_USERS: \
118 PER_DATA_TYPE_MACRO("ManagedUser"); \
119 break; \
120 case ::syncer::MANAGED_USER_SHARED_SETTINGS: \
121 PER_DATA_TYPE_MACRO("ManagedUserSharedSetting"); \
122 break; \
123 case ::syncer::ARTICLES: \
124 PER_DATA_TYPE_MACRO("Article"); \
125 break; \
126 case ::syncer::PROXY_TABS: \
127 PER_DATA_TYPE_MACRO("Tabs"); \
128 break; \
129 default: \
130 NOTREACHED() << "Unknown datatype " \
131 << ::syncer::ModelTypeToString(datatype); \
133 } while (0)
135 #endif // SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_