Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: metrics_library.cc

Issue 6094010: Add support for user actions to the metrics library and the metrics clients. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/metrics.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « metrics_library.h ('k') | metrics_library_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "metrics_library.h" 5 #include "metrics_library.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/file.h> 8 #include <sys/file.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 215
216 bool MetricsLibrary::SendToUMA(const string& name, int sample, 216 bool MetricsLibrary::SendToUMA(const string& name, int sample,
217 int min, int max, int nbuckets) { 217 int min, int max, int nbuckets) {
218 // Format the message. 218 // Format the message.
219 char message[kBufferSize]; 219 char message[kBufferSize];
220 int32_t message_length = 220 int32_t message_length =
221 FormatChromeMessage(kBufferSize, message, 221 FormatChromeMessage(kBufferSize, message,
222 "histogram%c%s %d %d %d %d", '\0', 222 "histogram%c%s %d %d %d %d", '\0',
223 name.c_str(), sample, min, max, nbuckets); 223 name.c_str(), sample, min, max, nbuckets);
224
225 if (message_length < 0) 224 if (message_length < 0)
226 return false; 225 return false;
227 226
228 // Send the message. 227 // Send the message.
229 return SendMessageToChrome(message_length, message); 228 return SendMessageToChrome(message_length, message);
230 } 229 }
231 230
232 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample, 231 bool MetricsLibrary::SendEnumToUMA(const std::string& name, int sample,
233 int max) { 232 int max) {
234 // Format the message. 233 // Format the message.
235 char message[kBufferSize]; 234 char message[kBufferSize];
236 int32_t message_length = 235 int32_t message_length =
237 FormatChromeMessage(kBufferSize, message, 236 FormatChromeMessage(kBufferSize, message,
238 "linearhistogram%c%s %d %d", '\0', 237 "linearhistogram%c%s %d %d", '\0',
239 name.c_str(), sample, max); 238 name.c_str(), sample, max);
240
241 if (message_length < 0) 239 if (message_length < 0)
242 return false; 240 return false;
243 241
242 // Send the message.
243 return SendMessageToChrome(message_length, message);
244 }
245
246 bool MetricsLibrary::SendUserActionToUMA(const std::string& action) {
247 // Format the message.
248 char message[kBufferSize];
249 int32_t message_length =
250 FormatChromeMessage(kBufferSize, message,
251 "useraction%c%s", '\0', action.c_str());
252 if (message_length < 0)
253 return false;
254
244 // Send the message. 255 // Send the message.
245 return SendMessageToChrome(message_length, message); 256 return SendMessageToChrome(message_length, message);
246 } 257 }
OLDNEW
« no previous file with comments | « metrics_library.h ('k') | metrics_library_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698