| 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 class CompilationStatistics; |
| 19 |
| 20 struct AsPrintableStatistics { |
| 21 const CompilationStatistics& s; |
| 22 const bool machine_output; |
| 23 }; |
| 18 | 24 |
| 19 class CompilationStatistics final : public Malloced { | 25 class CompilationStatistics final : public Malloced { |
| 20 public: | 26 public: |
| 21 CompilationStatistics() {} | 27 CompilationStatistics() {} |
| 22 | 28 |
| 23 class BasicStats { | 29 class BasicStats { |
| 24 public: | 30 public: |
| 25 BasicStats() | 31 BasicStats() |
| 26 : total_allocated_bytes_(0), | 32 : total_allocated_bytes_(0), |
| 27 max_allocated_bytes_(0), | 33 max_allocated_bytes_(0), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 58 }; | 64 }; |
| 59 | 65 |
| 60 class PhaseStats : public OrderedStats { | 66 class PhaseStats : public OrderedStats { |
| 61 public: | 67 public: |
| 62 PhaseStats(size_t insert_order, const char* phase_kind_name) | 68 PhaseStats(size_t insert_order, const char* phase_kind_name) |
| 63 : OrderedStats(insert_order), phase_kind_name_(phase_kind_name) {} | 69 : OrderedStats(insert_order), phase_kind_name_(phase_kind_name) {} |
| 64 std::string phase_kind_name_; | 70 std::string phase_kind_name_; |
| 65 }; | 71 }; |
| 66 | 72 |
| 67 friend std::ostream& operator<<(std::ostream& os, | 73 friend std::ostream& operator<<(std::ostream& os, |
| 68 const CompilationStatistics& s); | 74 const AsPrintableStatistics& s); |
| 69 | 75 |
| 70 typedef OrderedStats PhaseKindStats; | 76 typedef OrderedStats PhaseKindStats; |
| 71 typedef std::map<std::string, PhaseKindStats> PhaseKindMap; | 77 typedef std::map<std::string, PhaseKindStats> PhaseKindMap; |
| 72 typedef std::map<std::string, PhaseStats> PhaseMap; | 78 typedef std::map<std::string, PhaseStats> PhaseMap; |
| 73 | 79 |
| 74 TotalStats total_stats_; | 80 TotalStats total_stats_; |
| 75 PhaseKindMap phase_kind_map_; | 81 PhaseKindMap phase_kind_map_; |
| 76 PhaseMap phase_map_; | 82 PhaseMap phase_map_; |
| 77 | 83 |
| 78 DISALLOW_COPY_AND_ASSIGN(CompilationStatistics); | 84 DISALLOW_COPY_AND_ASSIGN(CompilationStatistics); |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 std::ostream& operator<<(std::ostream& os, const CompilationStatistics& s); | 87 std::ostream& operator<<(std::ostream& os, const AsPrintableStatistics& s); |
| 82 | 88 |
| 83 } // namespace internal | 89 } // namespace internal |
| 84 } // namespace v8 | 90 } // namespace v8 |
| 85 | 91 |
| 86 #endif | 92 #endif |
| OLD | NEW |