| OLD | NEW |
| 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 /* | 5 /* |
| 6 * metrics_library.cc | 6 * metrics_library.cc |
| 7 * | 7 * |
| 8 * Created on: Dec 1, 2009 | 8 * Created on: Dec 1, 2009 |
| 9 * Author: sosa | 9 * Author: sosa |
| 10 */ | 10 */ |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 FormatChromeMessage(kBufferSize, message, | 143 FormatChromeMessage(kBufferSize, message, |
| 144 "histogram%c%s %d %d %d %d", '\0', | 144 "histogram%c%s %d %d %d %d", '\0', |
| 145 name.c_str(), sample, min, max, nbuckets); | 145 name.c_str(), sample, min, max, nbuckets); |
| 146 | 146 |
| 147 if (message_length < 0) | 147 if (message_length < 0) |
| 148 return false; | 148 return false; |
| 149 | 149 |
| 150 // Send the message. | 150 // Send the message. |
| 151 return SendMessageToChrome(message_length, message); | 151 return SendMessageToChrome(message_length, message); |
| 152 } | 152 } |
| 153 |
| 154 //static |
| 155 bool MetricsLibrary::SendEnumToChrome(const std::string& name, int sample, |
| 156 int max) { |
| 157 // Format the message. |
| 158 char message[kBufferSize]; |
| 159 int32_t message_length = |
| 160 FormatChromeMessage(kBufferSize, message, |
| 161 "linearhistogram%c%s %d %d", '\0', |
| 162 name.c_str(), sample, max); |
| 163 |
| 164 if (message_length < 0) |
| 165 return false; |
| 166 |
| 167 // Send the message. |
| 168 return SendMessageToChrome(message_length, message); |
| 169 } |
| OLD | NEW |