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 <string> | 8 #include <string> |
9 | 9 |
| 10 #include "src/base/platform/elapsed-timer.h" |
| 11 #include "src/base/smart-pointers.h" |
10 #include "src/compilation-statistics.h" | 12 #include "src/compilation-statistics.h" |
11 #include "src/compiler/zone-pool.h" | 13 #include "src/compiler/zone-pool.h" |
12 | 14 |
13 namespace v8 { | 15 namespace v8 { |
14 namespace internal { | 16 namespace internal { |
15 namespace compiler { | 17 namespace compiler { |
16 | 18 |
17 class PhaseScope; | 19 class PhaseScope; |
18 | 20 |
19 class PipelineStatistics : public Malloced { | 21 class PipelineStatistics : public Malloced { |
20 public: | 22 public: |
21 PipelineStatistics(CompilationInfo* info, ZonePool* zone_pool); | 23 PipelineStatistics(CompilationInfo* info, ZonePool* zone_pool); |
22 ~PipelineStatistics(); | 24 ~PipelineStatistics(); |
23 | 25 |
24 void BeginPhaseKind(const char* phase_kind_name); | 26 void BeginPhaseKind(const char* phase_kind_name); |
| 27 void EndPhaseKind(); |
25 | 28 |
26 private: | 29 private: |
27 size_t OuterZoneSize() { | 30 size_t OuterZoneSize() { |
28 return static_cast<size_t>(outer_zone_->allocation_size()); | 31 return static_cast<size_t>(outer_zone_->allocation_size()); |
29 } | 32 } |
30 | 33 |
31 class CommonStats { | 34 class CommonStats { |
32 public: | 35 public: |
33 CommonStats() : outer_zone_initial_size_(0) {} | 36 CommonStats() : outer_zone_initial_size_(0) {} |
34 | 37 |
35 void Begin(PipelineStatistics* pipeline_stats); | 38 void Begin(PipelineStatistics* pipeline_stats); |
36 void End(PipelineStatistics* pipeline_stats, | 39 void End(PipelineStatistics* pipeline_stats, |
37 CompilationStatistics::BasicStats* diff); | 40 CompilationStatistics::BasicStats* diff); |
38 | 41 |
39 base::SmartPointer<ZonePool::StatsScope> scope_; | 42 base::SmartPointer<ZonePool::StatsScope> scope_; |
40 base::ElapsedTimer timer_; | 43 base::ElapsedTimer timer_; |
41 size_t outer_zone_initial_size_; | 44 size_t outer_zone_initial_size_; |
42 size_t allocated_bytes_at_start_; | 45 size_t allocated_bytes_at_start_; |
43 }; | 46 }; |
44 | 47 |
45 bool InPhaseKind() { return !phase_kind_stats_.scope_.is_empty(); } | 48 bool InPhaseKind() { return !phase_kind_stats_.scope_.is_empty(); } |
46 void EndPhaseKind(); | |
47 | 49 |
48 friend class PhaseScope; | 50 friend class PhaseScope; |
49 bool InPhase() { return !phase_stats_.scope_.is_empty(); } | 51 bool InPhase() { return !phase_stats_.scope_.is_empty(); } |
50 void BeginPhase(const char* name); | 52 void BeginPhase(const char* name); |
51 void EndPhase(); | 53 void EndPhase(); |
52 | 54 |
53 Isolate* isolate_; | 55 Isolate* isolate_; |
54 Zone* outer_zone_; | 56 Zone* outer_zone_; |
55 ZonePool* zone_pool_; | 57 ZonePool* zone_pool_; |
56 CompilationStatistics* compilation_stats_; | 58 CompilationStatistics* compilation_stats_; |
(...skipping 29 matching lines...) Expand all Loading... |
86 PipelineStatistics* const pipeline_stats_; | 88 PipelineStatistics* const pipeline_stats_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(PhaseScope); | 90 DISALLOW_COPY_AND_ASSIGN(PhaseScope); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace compiler | 93 } // namespace compiler |
92 } // namespace internal | 94 } // namespace internal |
93 } // namespace v8 | 95 } // namespace v8 |
94 | 96 |
95 #endif | 97 #endif |
OLD | NEW |