| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 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 #ifndef V8_COMPILATION_STATISTICS_H_ | 5 #ifndef V8_COMPILATION_STATISTICS_H_ |
| 6 #define V8_COMPILATION_STATISTICS_H_ | 6 #define V8_COMPILATION_STATISTICS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "src/allocation.h" | 11 #include "src/allocation.h" |
| 12 #include "src/base/platform/time.h" | 12 #include "src/base/platform/time.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 class CompilationInfo; | 17 class CompilationInfo; |
| 18 | 18 |
| 19 class CompilationStatistics final : public Malloced { | 19 class CompilationStatistics final : public Malloced { |
| 20 public: | 20 public: |
| 21 CompilationStatistics() {} | 21 explicit CompilationStatistics(bool machine_output) |
| 22 : machine_output_(machine_output) {} |
| 22 | 23 |
| 23 class BasicStats { | 24 class BasicStats { |
| 24 public: | 25 public: |
| 25 BasicStats() | 26 BasicStats() |
| 26 : total_allocated_bytes_(0), | 27 : total_allocated_bytes_(0), |
| 27 max_allocated_bytes_(0), | 28 max_allocated_bytes_(0), |
| 28 absolute_max_allocated_bytes_(0) {} | 29 absolute_max_allocated_bytes_(0) {} |
| 29 | 30 |
| 30 void Accumulate(const BasicStats& stats); | 31 void Accumulate(const BasicStats& stats); |
| 31 | 32 |
| 32 base::TimeDelta delta_; | 33 base::TimeDelta delta_; |
| 33 size_t total_allocated_bytes_; | 34 size_t total_allocated_bytes_; |
| 34 size_t max_allocated_bytes_; | 35 size_t max_allocated_bytes_; |
| 35 size_t absolute_max_allocated_bytes_; | 36 size_t absolute_max_allocated_bytes_; |
| 36 std::string function_name_; | 37 std::string function_name_; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 void RecordPhaseStats(const char* phase_kind_name, const char* phase_name, | 40 void RecordPhaseStats(const char* phase_kind_name, const char* phase_name, |
| 40 const BasicStats& stats); | 41 const BasicStats& stats); |
| 41 | 42 |
| 42 void RecordPhaseKindStats(const char* phase_kind_name, | 43 void RecordPhaseKindStats(const char* phase_kind_name, |
| 43 const BasicStats& stats); | 44 const BasicStats& stats); |
| 44 | 45 |
| 45 void RecordTotalStats(size_t source_size, const BasicStats& stats); | 46 void RecordTotalStats(size_t source_size, const BasicStats& stats); |
| 46 | 47 |
| 48 bool machine_output() const { return machine_output_; } |
| 49 |
| 47 private: | 50 private: |
| 48 class TotalStats : public BasicStats { | 51 class TotalStats : public BasicStats { |
| 49 public: | 52 public: |
| 50 TotalStats() : source_size_(0) {} | 53 TotalStats() : source_size_(0) {} |
| 51 uint64_t source_size_; | 54 uint64_t source_size_; |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 class OrderedStats : public BasicStats { | 57 class OrderedStats : public BasicStats { |
| 55 public: | 58 public: |
| 56 explicit OrderedStats(size_t insert_order) : insert_order_(insert_order) {} | 59 explicit OrderedStats(size_t insert_order) : insert_order_(insert_order) {} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 friend std::ostream& operator<<(std::ostream& os, | 70 friend std::ostream& operator<<(std::ostream& os, |
| 68 const CompilationStatistics& s); | 71 const CompilationStatistics& s); |
| 69 | 72 |
| 70 typedef OrderedStats PhaseKindStats; | 73 typedef OrderedStats PhaseKindStats; |
| 71 typedef std::map<std::string, PhaseKindStats> PhaseKindMap; | 74 typedef std::map<std::string, PhaseKindStats> PhaseKindMap; |
| 72 typedef std::map<std::string, PhaseStats> PhaseMap; | 75 typedef std::map<std::string, PhaseStats> PhaseMap; |
| 73 | 76 |
| 74 TotalStats total_stats_; | 77 TotalStats total_stats_; |
| 75 PhaseKindMap phase_kind_map_; | 78 PhaseKindMap phase_kind_map_; |
| 76 PhaseMap phase_map_; | 79 PhaseMap phase_map_; |
| 80 bool machine_output_; |
| 77 | 81 |
| 78 DISALLOW_COPY_AND_ASSIGN(CompilationStatistics); | 82 DISALLOW_COPY_AND_ASSIGN(CompilationStatistics); |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s); | 85 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s); |
| 82 | 86 |
| 83 } // namespace internal | 87 } // namespace internal |
| 84 } // namespace v8 | 88 } // namespace v8 |
| 85 | 89 |
| 86 #endif | 90 #endif |
| OLD | NEW |