Remove unused parameter.
[chromium-blink-merge.git] / sync / util / data_type_histogram.h
blob2c4ac8e49e59e0da2223fc5975a8c67bad364999
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::AUTOFILL_WALLET_DATA: \
55 PER_DATA_TYPE_MACRO("AutofillWallet"); \
56 break; \
57 case ::syncer::THEMES: \
58 PER_DATA_TYPE_MACRO("Themes"); \
59 break; \
60 case ::syncer::TYPED_URLS: \
61 PER_DATA_TYPE_MACRO("TypedUrls"); \
62 break; \
63 case ::syncer::EXTENSIONS: \
64 PER_DATA_TYPE_MACRO("Extensions"); \
65 break; \
66 case ::syncer::NIGORI: \
67 PER_DATA_TYPE_MACRO("Nigori"); \
68 break; \
69 case ::syncer::SEARCH_ENGINES: \
70 PER_DATA_TYPE_MACRO("SearchEngines"); \
71 break; \
72 case ::syncer::SESSIONS: \
73 PER_DATA_TYPE_MACRO("Sessions"); \
74 break; \
75 case ::syncer::APPS: \
76 PER_DATA_TYPE_MACRO("Apps"); \
77 break; \
78 case ::syncer::APP_LIST: \
79 PER_DATA_TYPE_MACRO("AppList"); \
80 break; \
81 case ::syncer::APP_SETTINGS: \
82 PER_DATA_TYPE_MACRO("AppSettings"); \
83 break; \
84 case ::syncer::EXTENSION_SETTINGS: \
85 PER_DATA_TYPE_MACRO("ExtensionSettings"); \
86 break; \
87 case ::syncer::APP_NOTIFICATIONS: \
88 PER_DATA_TYPE_MACRO("AppNotifications"); \
89 break; \
90 case ::syncer::HISTORY_DELETE_DIRECTIVES: \
91 PER_DATA_TYPE_MACRO("HistoryDeleteDirectives"); \
92 break; \
93 case ::syncer::SYNCED_NOTIFICATIONS: \
94 PER_DATA_TYPE_MACRO("SyncedNotifications"); \
95 break; \
96 case ::syncer::SYNCED_NOTIFICATION_APP_INFO: \
97 PER_DATA_TYPE_MACRO("SyncedNotificationAppInfo"); \
98 break; \
99 case ::syncer::DEVICE_INFO: \
100 PER_DATA_TYPE_MACRO("DeviceInfo"); \
101 break; \
102 case ::syncer::EXPERIMENTS: \
103 PER_DATA_TYPE_MACRO("Experiments"); \
104 break; \
105 case ::syncer::PRIORITY_PREFERENCES :\
106 PER_DATA_TYPE_MACRO("PriorityPreferences"); \
107 break; \
108 case ::syncer::DICTIONARY: \
109 PER_DATA_TYPE_MACRO("Dictionary"); \
110 break; \
111 case ::syncer::FAVICON_IMAGES: \
112 PER_DATA_TYPE_MACRO("FaviconImages"); \
113 break; \
114 case ::syncer::FAVICON_TRACKING: \
115 PER_DATA_TYPE_MACRO("FaviconTracking"); \
116 break; \
117 case ::syncer::SUPERVISED_USER_SETTINGS: \
118 PER_DATA_TYPE_MACRO("ManagedUserSetting"); \
119 break; \
120 case ::syncer::SUPERVISED_USERS: \
121 PER_DATA_TYPE_MACRO("ManagedUser"); \
122 break; \
123 case ::syncer::SUPERVISED_USER_SHARED_SETTINGS: \
124 PER_DATA_TYPE_MACRO("ManagedUserSharedSetting"); \
125 break; \
126 case ::syncer::SUPERVISED_USER_WHITELISTS: \
127 PER_DATA_TYPE_MACRO("ManagedUserWhitelist"); \
128 break; \
129 case ::syncer::ARTICLES: \
130 PER_DATA_TYPE_MACRO("Article"); \
131 break; \
132 case ::syncer::WIFI_CREDENTIALS: \
133 PER_DATA_TYPE_MACRO("WifiCredentials"); \
134 break; \
135 case ::syncer::PROXY_TABS: \
136 PER_DATA_TYPE_MACRO("Tabs"); \
137 break; \
138 default: \
139 NOTREACHED() << "Unknown datatype " \
140 << ::syncer::ModelTypeToString(datatype); \
142 } while (0)
144 #endif // SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_