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

Side by Side Diff: src/counters.cc

Issue 2349593004: Revert of [Tracing] Remove unnecessary memory allocation in runtime call stats. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 "src/counters.h" 5 #include "src/counters.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/isolate.h" 10 #include "src/isolate.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 #define DUMP_COUNTER(name) \ 386 #define DUMP_COUNTER(name) \
387 if (this->API_##name.count > 0) this->API_##name.Dump(buffer_); 387 if (this->API_##name.count > 0) this->API_##name.Dump(buffer_);
388 FOR_EACH_API_COUNTER(DUMP_COUNTER) 388 FOR_EACH_API_COUNTER(DUMP_COUNTER)
389 #undef DUMP_COUNTER 389 #undef DUMP_COUNTER
390 390
391 #define DUMP_COUNTER(name) \ 391 #define DUMP_COUNTER(name) \
392 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_); 392 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_);
393 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER) 393 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER)
394 #undef DUMP_COUNTER 394 #undef DUMP_COUNTER
395 buffer_ << "\"END\":[]}"; 395 buffer_ << "\"END\":[]}";
396 const std::string& buffer_str = buffer_.str();
397 size_t length = buffer_str.size();
398 if (length > len_) {
399 buffer_c_str_.reset(new char[length + 1]);
400 len_ = length;
401 }
402 strncpy(buffer_c_str_.get(), buffer_str.c_str(), length + 1);
396 in_use_ = false; 403 in_use_ = false;
397 return buffer_.str().c_str(); 404 return buffer_c_str_.get();
398 } 405 }
399 406
400 } // namespace internal 407 } // namespace internal
401 } // namespace v8 408 } // namespace v8
OLDNEW
« no previous file with comments | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698