OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_PROFILE_GENERATOR_H_ | 28 #ifndef V8_PROFILE_GENERATOR_H_ |
29 #define V8_PROFILE_GENERATOR_H_ | 29 #define V8_PROFILE_GENERATOR_H_ |
30 | 30 |
31 #include "allocation.h" | 31 #include "allocation.h" |
32 #include "hashmap.h" | 32 #include "hashmap.h" |
| 33 #include "time/time.h" |
33 #include "../include/v8-profiler.h" | 34 #include "../include/v8-profiler.h" |
34 | 35 |
35 namespace v8 { | 36 namespace v8 { |
36 namespace internal { | 37 namespace internal { |
37 | 38 |
38 struct OffsetRange; | 39 struct OffsetRange; |
39 | 40 |
40 // Provides a storage of strings allocated in C++ heap, to hold them | 41 // Provides a storage of strings allocated in C++ heap, to hold them |
41 // forever, even if they disappear from JS heap or external storage. | 42 // forever, even if they disappear from JS heap or external storage. |
42 class StringsStorage { | 43 class StringsStorage { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void AddPath(const Vector<CodeEntry*>& path); | 196 void AddPath(const Vector<CodeEntry*>& path); |
196 void CalculateTotalTicksAndSamplingRate(); | 197 void CalculateTotalTicksAndSamplingRate(); |
197 | 198 |
198 const char* title() const { return title_; } | 199 const char* title() const { return title_; } |
199 unsigned uid() const { return uid_; } | 200 unsigned uid() const { return uid_; } |
200 const ProfileTree* top_down() const { return &top_down_; } | 201 const ProfileTree* top_down() const { return &top_down_; } |
201 | 202 |
202 int samples_count() const { return samples_.length(); } | 203 int samples_count() const { return samples_.length(); } |
203 ProfileNode* sample(int index) const { return samples_.at(index); } | 204 ProfileNode* sample(int index) const { return samples_.at(index); } |
204 | 205 |
205 int64_t start_time_us() const { return start_time_us_; } | 206 Time start_time() const { return start_time_; } |
206 int64_t end_time_us() const { return end_time_us_; } | 207 Time end_time() const { return end_time_; } |
207 | 208 |
208 void UpdateTicksScale(); | 209 void UpdateTicksScale(); |
209 | 210 |
210 void Print(); | 211 void Print(); |
211 | 212 |
212 private: | 213 private: |
213 const char* title_; | 214 const char* title_; |
214 unsigned uid_; | 215 unsigned uid_; |
215 bool record_samples_; | 216 bool record_samples_; |
216 int64_t start_time_us_; | 217 Time start_time_; |
217 int64_t end_time_us_; | 218 Time end_time_; |
| 219 ElapsedTimer timer_; |
218 List<ProfileNode*> samples_; | 220 List<ProfileNode*> samples_; |
219 ProfileTree top_down_; | 221 ProfileTree top_down_; |
220 | 222 |
221 DISALLOW_COPY_AND_ASSIGN(CpuProfile); | 223 DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
222 }; | 224 }; |
223 | 225 |
224 | 226 |
225 class CodeMap { | 227 class CodeMap { |
226 public: | 228 public: |
227 CodeMap() : next_shared_id_(1) { } | 229 CodeMap() : next_shared_id_(1) { } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 CodeEntry* gc_entry_; | 345 CodeEntry* gc_entry_; |
344 CodeEntry* unresolved_entry_; | 346 CodeEntry* unresolved_entry_; |
345 | 347 |
346 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 348 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
347 }; | 349 }; |
348 | 350 |
349 | 351 |
350 } } // namespace v8::internal | 352 } } // namespace v8::internal |
351 | 353 |
352 #endif // V8_PROFILE_GENERATOR_H_ | 354 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |