OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_COMPILATION_STATISTICS_H_ |
| 6 #define V8_COMPILATION_STATISTICS_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 |
| 11 #include "src/allocation.h" |
| 12 #include "src/base/platform/time.h" |
| 13 |
| 14 namespace v8 { |
| 15 namespace internal { |
| 16 |
| 17 class CompilationInfo; |
| 18 |
| 19 class CompilationStatistics FINAL : public Malloced { |
| 20 public: |
| 21 CompilationStatistics() {} |
| 22 |
| 23 class BasicStats { |
| 24 public: |
| 25 BasicStats() : total_allocated_bytes_(0), max_allocated_bytes_(0) {} |
| 26 |
| 27 void Accumulate(const BasicStats& stats); |
| 28 |
| 29 base::TimeDelta delta_; |
| 30 size_t total_allocated_bytes_; |
| 31 size_t max_allocated_bytes_; |
| 32 std::string function_name_; |
| 33 }; |
| 34 |
| 35 void RecordPhaseStats(const char* phase_kind_name, const char* phase_name, |
| 36 const BasicStats& stats); |
| 37 |
| 38 void RecordPhaseKindStats(const char* phase_kind_name, |
| 39 const BasicStats& stats); |
| 40 |
| 41 void RecordTotalStats(size_t source_size, const BasicStats& stats); |
| 42 |
| 43 private: |
| 44 class TotalStats : public BasicStats { |
| 45 public: |
| 46 TotalStats() : source_size_(0) {} |
| 47 uint64_t source_size_; |
| 48 }; |
| 49 |
| 50 class OrderedStats : public BasicStats { |
| 51 public: |
| 52 explicit OrderedStats(size_t insert_order) : insert_order_(insert_order) {} |
| 53 size_t insert_order_; |
| 54 }; |
| 55 |
| 56 class PhaseStats : public OrderedStats { |
| 57 public: |
| 58 PhaseStats(size_t insert_order, const char* phase_kind_name) |
| 59 : OrderedStats(insert_order), phase_kind_name_(phase_kind_name) {} |
| 60 std::string phase_kind_name_; |
| 61 }; |
| 62 |
| 63 friend std::ostream& operator<<(std::ostream& os, |
| 64 const CompilationStatistics& s); |
| 65 |
| 66 typedef OrderedStats PhaseKindStats; |
| 67 typedef std::map<std::string, PhaseKindStats> PhaseKindMap; |
| 68 typedef std::map<std::string, PhaseStats> PhaseMap; |
| 69 |
| 70 TotalStats total_stats_; |
| 71 PhaseKindMap phase_kind_map_; |
| 72 PhaseMap phase_map_; |
| 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(CompilationStatistics); |
| 75 }; |
| 76 |
| 77 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s); |
| 78 |
| 79 } // namespace internal |
| 80 } // namespace v8 |
| 81 |
| 82 #endif |
OLD | NEW |