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

Side by Side Diff: courgette/memory_monitor.cc

Issue 4974001: base: Get rid of 'using' declaration of StringAppendF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years, 1 month 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 | « courgette/adjustment_method_2.cc ('k') | net/http/http_cache_unittest.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <stdio.h> 5 #include <stdio.h>
6 #include <map> 6 #include <map>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 10
(...skipping 29 matching lines...) Expand all
40 d_tick_ %= T; 40 d_tick_ %= T;
41 print = true; 41 print = true;
42 } 42 }
43 if (d_bw_ >= M) { 43 if (d_bw_ >= M) {
44 bw_ += (d_bw_/M) * M; 44 bw_ += (d_bw_/M) * M;
45 d_bw_ %= M; 45 d_bw_ %= M;
46 print = true; 46 print = true;
47 } 47 }
48 if (!print) return; 48 if (!print) return;
49 std::string o; 49 std::string o;
50 StringAppendF(&o, "%u:", tick_ + d_tick_); 50 base::StringAppendF(&o, "%u:", tick_ + d_tick_);
51 StringAppendF(&o, " (%c%s)", sign, fmt(w).c_str()); 51 base::StringAppendF(&o, " (%c%s)", sign, fmt(w).c_str());
52 size_t sum = 0; 52 size_t sum = 0;
53 for (M::iterator p = c_.begin(); p != c_.end(); ++p) { 53 for (M::iterator p = c_.begin(); p != c_.end(); ++p) {
54 size_t s = p->first; 54 size_t s = p->first;
55 size_t n = p->second; 55 size_t n = p->second;
56 if (n) { 56 if (n) {
57 if (s*n >= 64*1024) 57 if (s*n >= 64*1024)
58 if (n == 1) 58 if (n == 1)
59 StringAppendF(&o, " %s", fmt(s).c_str()); 59 base::StringAppendF(&o, " %s", fmt(s).c_str());
60 else 60 else
61 StringAppendF(&o, " %s*%u", fmt(s).c_str(), n); 61 base::StringAppendF(&o, " %s*%u", fmt(s).c_str(), n);
62 sum += s*n; 62 sum += s*n;
63 } 63 }
64 } 64 }
65 StringAppendF(&o, " = %s", fmt(sum).c_str()); 65 base::StringAppendF(&o, " = %s", fmt(sum).c_str());
66 LOG(INFO) << o; 66 LOG(INFO) << o;
67 //printf("%s\n", o.c_str()); 67 //printf("%s\n", o.c_str());
68 if (sum > 200*1024*1024) { 68 if (sum > 200*1024*1024) {
69 // __asm int 3; 69 // __asm int 3;
70 m_bw_ = sum; 70 m_bw_ = sum;
71 } 71 }
72 } 72 }
73 void add(size_t s, void *p) { 73 void add(size_t s, void *p) {
74 if (!inH) { 74 if (!inH) {
75 inH = true; 75 inH = true;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 //printf("%u\n", s); 117 //printf("%u\n", s);
118 void *p = malloc(s); 118 void *p = malloc(s);
119 _H.add(s, p); 119 _H.add(s, p);
120 return p; 120 return p;
121 } 121 }
122 122
123 void operator delete(void *p) { 123 void operator delete(void *p) {
124 _H.sub(p); 124 _H.sub(p);
125 free(p); 125 free(p);
126 } 126 }
OLDNEW
« no previous file with comments | « courgette/adjustment_method_2.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698