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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 << "Time" << std::setw(18) << "Count" << std::endl | 205 << "Time" << std::setw(18) << "Count" << std::endl |
206 << std::string(88, '=') << std::endl; | 206 << std::string(88, '=') << std::endl; |
207 for (Entry& entry : entries) { | 207 for (Entry& entry : entries) { |
208 entry.SetTotal(total_time, total_call_count); | 208 entry.SetTotal(total_time, total_call_count); |
209 entry.Print(os); | 209 entry.Print(os); |
210 } | 210 } |
211 os << std::string(88, '-') << std::endl; | 211 os << std::string(88, '-') << std::endl; |
212 Entry("Total", total_time, total_call_count).Print(os); | 212 Entry("Total", total_time, total_call_count).Print(os); |
213 } | 213 } |
214 | 214 |
215 void Add(RuntimeCallCounter* counter) { | 215 // By default, the compiler will usually inline this, which results in a large |
| 216 // binary size increase: std::vector::push_back expands to a large amount of |
| 217 // instructions, and this function is invoked repeatedly by macros. |
| 218 V8_NOINLINE void Add(RuntimeCallCounter* counter) { |
216 if (counter->count == 0) return; | 219 if (counter->count == 0) return; |
217 entries.push_back(Entry(counter->name, counter->time, counter->count)); | 220 entries.push_back(Entry(counter->name, counter->time, counter->count)); |
218 total_time += counter->time; | 221 total_time += counter->time; |
219 total_call_count += counter->count; | 222 total_call_count += counter->count; |
220 } | 223 } |
221 | 224 |
222 private: | 225 private: |
223 class Entry { | 226 class Entry { |
224 public: | 227 public: |
225 Entry(const char* name, base::TimeDelta time, uint64_t count) | 228 Entry(const char* name, base::TimeDelta time, uint64_t count) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 FOR_EACH_API_COUNTER(RESET_COUNTER) | 354 FOR_EACH_API_COUNTER(RESET_COUNTER) |
352 #undef RESET_COUNTER | 355 #undef RESET_COUNTER |
353 | 356 |
354 #define RESET_COUNTER(name) this->Handler_##name.Reset(); | 357 #define RESET_COUNTER(name) this->Handler_##name.Reset(); |
355 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) | 358 FOR_EACH_HANDLER_COUNTER(RESET_COUNTER) |
356 #undef RESET_COUNTER | 359 #undef RESET_COUNTER |
357 } | 360 } |
358 | 361 |
359 } // namespace internal | 362 } // namespace internal |
360 } // namespace v8 | 363 } // namespace v8 |
OLD | NEW |