OLD | NEW |
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 count_(count), | 231 count_(count), |
232 time_percent_(100), | 232 time_percent_(100), |
233 count_percent_(100) {} | 233 count_percent_(100) {} |
234 | 234 |
235 bool operator<(const Entry& other) const { | 235 bool operator<(const Entry& other) const { |
236 if (time_ < other.time_) return true; | 236 if (time_ < other.time_) return true; |
237 if (time_ > other.time_) return false; | 237 if (time_ > other.time_) return false; |
238 return count_ < other.count_; | 238 return count_ < other.count_; |
239 } | 239 } |
240 | 240 |
241 void Print(std::ostream& os) { | 241 V8_NOINLINE void Print(std::ostream& os) { |
242 os.precision(2); | 242 os.precision(2); |
243 os << std::fixed << std::setprecision(2); | 243 os << std::fixed << std::setprecision(2); |
244 os << std::setw(50) << name_; | 244 os << std::setw(50) << name_; |
245 os << std::setw(10) << static_cast<double>(time_) / 1000 << "ms "; | 245 os << std::setw(10) << static_cast<double>(time_) / 1000 << "ms "; |
246 os << std::setw(6) << time_percent_ << "%"; | 246 os << std::setw(6) << time_percent_ << "%"; |
247 os << std::setw(10) << count_ << " "; | 247 os << std::setw(10) << count_ << " "; |
248 os << std::setw(6) << count_percent_ << "%"; | 248 os << std::setw(6) << count_percent_ << "%"; |
249 os << std::endl; | 249 os << std::endl; |
250 } | 250 } |
251 | 251 |
252 void SetTotal(base::TimeDelta total_time, uint64_t total_count) { | 252 V8_NOINLINE void SetTotal(base::TimeDelta total_time, |
| 253 uint64_t total_count) { |
253 if (total_time.InMicroseconds() == 0) { | 254 if (total_time.InMicroseconds() == 0) { |
254 time_percent_ = 0; | 255 time_percent_ = 0; |
255 } else { | 256 } else { |
256 time_percent_ = 100.0 * time_ / total_time.InMicroseconds(); | 257 time_percent_ = 100.0 * time_ / total_time.InMicroseconds(); |
257 } | 258 } |
258 count_percent_ = 100.0 * count_ / total_count; | 259 count_percent_ = 100.0 * count_ / total_count; |
259 } | 260 } |
260 | 261 |
261 private: | 262 private: |
262 const char* name_; | 263 const char* name_; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_); | 393 if (this->Handler_##name.count > 0) this->Handler_##name.Dump(buffer_); |
393 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER) | 394 FOR_EACH_HANDLER_COUNTER(DUMP_COUNTER) |
394 #undef DUMP_COUNTER | 395 #undef DUMP_COUNTER |
395 buffer_ << "\"END\":[]}"; | 396 buffer_ << "\"END\":[]}"; |
396 in_use_ = false; | 397 in_use_ = false; |
397 return buffer_.str(); | 398 return buffer_.str(); |
398 } | 399 } |
399 | 400 |
400 } // namespace internal | 401 } // namespace internal |
401 } // namespace v8 | 402 } // namespace v8 |
OLD | NEW |