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_COMPILER_PIPELINE_STATISTICS_H_ | 5 #ifndef V8_COMPILER_PIPELINE_STATISTICS_H_ |
6 #define V8_COMPILER_PIPELINE_STATISTICS_H_ | 6 #define V8_COMPILER_PIPELINE_STATISTICS_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "src/base/platform/elapsed-timer.h" | 11 #include "src/base/platform/elapsed-timer.h" |
12 #include "src/compilation-statistics.h" | 12 #include "src/compilation-statistics.h" |
13 #include "src/compiler/zone-pool.h" | 13 #include "src/compiler/zonestats.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 class PhaseScope; | 19 class PhaseScope; |
20 | 20 |
21 class PipelineStatistics : public Malloced { | 21 class PipelineStatistics : public Malloced { |
22 public: | 22 public: |
23 PipelineStatistics(CompilationInfo* info, ZonePool* zone_pool); | 23 PipelineStatistics(CompilationInfo* info, ZoneStats* zone_stats); |
24 ~PipelineStatistics(); | 24 ~PipelineStatistics(); |
25 | 25 |
26 void BeginPhaseKind(const char* phase_kind_name); | 26 void BeginPhaseKind(const char* phase_kind_name); |
27 void EndPhaseKind(); | 27 void EndPhaseKind(); |
28 | 28 |
29 private: | 29 private: |
30 size_t OuterZoneSize() { | 30 size_t OuterZoneSize() { |
31 return static_cast<size_t>(outer_zone_->allocation_size()); | 31 return static_cast<size_t>(outer_zone_->allocation_size()); |
32 } | 32 } |
33 | 33 |
34 class CommonStats { | 34 class CommonStats { |
35 public: | 35 public: |
36 CommonStats() : outer_zone_initial_size_(0) {} | 36 CommonStats() : outer_zone_initial_size_(0) {} |
37 | 37 |
38 void Begin(PipelineStatistics* pipeline_stats); | 38 void Begin(PipelineStatistics* pipeline_stats); |
39 void End(PipelineStatistics* pipeline_stats, | 39 void End(PipelineStatistics* pipeline_stats, |
40 CompilationStatistics::BasicStats* diff); | 40 CompilationStatistics::BasicStats* diff); |
41 | 41 |
42 std::unique_ptr<ZonePool::StatsScope> scope_; | 42 std::unique_ptr<ZoneStats::StatsScope> scope_; |
43 base::ElapsedTimer timer_; | 43 base::ElapsedTimer timer_; |
44 size_t outer_zone_initial_size_; | 44 size_t outer_zone_initial_size_; |
45 size_t allocated_bytes_at_start_; | 45 size_t allocated_bytes_at_start_; |
46 | 46 |
47 private: | 47 private: |
48 DISALLOW_COPY_AND_ASSIGN(CommonStats); | 48 DISALLOW_COPY_AND_ASSIGN(CommonStats); |
49 }; | 49 }; |
50 | 50 |
51 bool InPhaseKind() { return !!phase_kind_stats_.scope_; } | 51 bool InPhaseKind() { return !!phase_kind_stats_.scope_; } |
52 | 52 |
53 friend class PhaseScope; | 53 friend class PhaseScope; |
54 bool InPhase() { return !!phase_stats_.scope_; } | 54 bool InPhase() { return !!phase_stats_.scope_; } |
55 void BeginPhase(const char* name); | 55 void BeginPhase(const char* name); |
56 void EndPhase(); | 56 void EndPhase(); |
57 | 57 |
58 Isolate* isolate_; | 58 Isolate* isolate_; |
59 Zone* outer_zone_; | 59 Zone* outer_zone_; |
60 ZonePool* zone_pool_; | 60 ZoneStats* zone_stats_; |
61 CompilationStatistics* compilation_stats_; | 61 CompilationStatistics* compilation_stats_; |
62 std::string function_name_; | 62 std::string function_name_; |
63 | 63 |
64 // Stats for the entire compilation. | 64 // Stats for the entire compilation. |
65 CommonStats total_stats_; | 65 CommonStats total_stats_; |
66 size_t source_size_; | 66 size_t source_size_; |
67 | 67 |
68 // Stats for phase kind. | 68 // Stats for phase kind. |
69 const char* phase_kind_name_; | 69 const char* phase_kind_name_; |
70 CommonStats phase_kind_stats_; | 70 CommonStats phase_kind_stats_; |
(...skipping 20 matching lines...) Expand all Loading... |
91 PipelineStatistics* const pipeline_stats_; | 91 PipelineStatistics* const pipeline_stats_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(PhaseScope); | 93 DISALLOW_COPY_AND_ASSIGN(PhaseScope); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace compiler | 96 } // namespace compiler |
97 } // namespace internal | 97 } // namespace internal |
98 } // namespace v8 | 98 } // namespace v8 |
99 | 99 |
100 #endif | 100 #endif |
OLD | NEW |