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

Side by Side Diff: dbus/dbus_statistics.cc

Issue 12767006: [Cleanup] Remove StringPrintf from global namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, once more Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "dbus/dbus_statistics.h" 5 #include "dbus/dbus_statistics.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Add a line to the result and clear the counts. 213 // Add a line to the result and clear the counts.
214 std::string line; 214 std::string line;
215 if (show == SHOW_SERVICE) { 215 if (show == SHOW_SERVICE) {
216 line += stat->service; 216 line += stat->service;
217 } else { 217 } else {
218 // The interface usually includes the service so don't show both. 218 // The interface usually includes the service so don't show both.
219 line += stat->interface; 219 line += stat->interface;
220 if (show >= SHOW_METHOD) 220 if (show >= SHOW_METHOD)
221 line += "." + stat->method; 221 line += "." + stat->method;
222 } 222 }
223 line += StringPrintf(":"); 223 line += base::StringPrintf(":");
224 if (sent_blocking) { 224 if (sent_blocking) {
225 line += StringPrintf(" Sent (BLOCKING):"); 225 line += base::StringPrintf(" Sent (BLOCKING):");
226 if (format == FORMAT_TOTALS) 226 if (format == FORMAT_TOTALS)
227 line += StringPrintf(" %d", sent_blocking); 227 line += base::StringPrintf(" %d", sent_blocking);
228 else if (format == FORMAT_PER_MINUTE) 228 else if (format == FORMAT_PER_MINUTE)
229 line += StringPrintf(" %d/min", sent_blocking / dminutes); 229 line += base::StringPrintf(" %d/min", sent_blocking / dminutes);
230 else if (format == FORMAT_ALL) 230 else if (format == FORMAT_ALL)
231 line += StringPrintf(" %d (%d/min)", 231 line += base::StringPrintf(" %d (%d/min)",
232 sent_blocking, sent_blocking / dminutes); 232 sent_blocking, sent_blocking / dminutes);
233 } 233 }
234 if (sent) { 234 if (sent) {
235 line += StringPrintf(" Sent:"); 235 line += base::StringPrintf(" Sent:");
236 if (format == FORMAT_TOTALS) 236 if (format == FORMAT_TOTALS)
237 line += StringPrintf(" %d", sent); 237 line += base::StringPrintf(" %d", sent);
238 else if (format == FORMAT_PER_MINUTE) 238 else if (format == FORMAT_PER_MINUTE)
239 line += StringPrintf(" %d/min", sent / dminutes); 239 line += base::StringPrintf(" %d/min", sent / dminutes);
240 else if (format == FORMAT_ALL) 240 else if (format == FORMAT_ALL)
241 line += StringPrintf(" %d (%d/min)", sent, sent / dminutes); 241 line += base::StringPrintf(" %d (%d/min)", sent, sent / dminutes);
242 } 242 }
243 if (received) { 243 if (received) {
244 line += StringPrintf(" Received:"); 244 line += base::StringPrintf(" Received:");
245 if (format == FORMAT_TOTALS) 245 if (format == FORMAT_TOTALS)
246 line += StringPrintf(" %d", received); 246 line += base::StringPrintf(" %d", received);
247 else if (format == FORMAT_PER_MINUTE) 247 else if (format == FORMAT_PER_MINUTE)
248 line += StringPrintf(" %d/min", received / dminutes); 248 line += base::StringPrintf(" %d/min", received / dminutes);
249 else if (format == FORMAT_ALL) 249 else if (format == FORMAT_ALL)
250 line += StringPrintf(" %d (%d/min)", received, received / dminutes); 250 line += base::StringPrintf(
251 " %d (%d/min)", received, received / dminutes);
251 } 252 }
252 result += line + "\n"; 253 result += line + "\n";
253 sent = 0; 254 sent = 0;
254 sent_blocking = 0; 255 sent_blocking = 0;
255 received = 0; 256 received = 0;
256 } 257 }
257 return result; 258 return result;
258 } 259 }
259 260
260 namespace testing { 261 namespace testing {
(...skipping 12 matching lines...) Expand all
273 *sent = stat->sent_method_calls; 274 *sent = stat->sent_method_calls;
274 *received = stat->received_signals; 275 *received = stat->received_signals;
275 *blocking = stat->sent_blocking_method_calls; 276 *blocking = stat->sent_blocking_method_calls;
276 return true; 277 return true;
277 } 278 }
278 279
279 } // namespace testing 280 } // namespace testing
280 281
281 } // namespace statistics 282 } // namespace statistics
282 } // namespace dbus 283 } // namespace dbus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698