OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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_V8_PROFILER_H_ | 5 #ifndef V8_V8_PROFILER_H_ |
6 #define V8_V8_PROFILER_H_ | 6 #define V8_V8_PROFILER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include "v8.h" // NOLINT(build/include) | 9 #include "v8.h" // NOLINT(build/include) |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 }; | 39 }; |
40 | 40 |
41 } // namespace v8 | 41 } // namespace v8 |
42 | 42 |
43 #ifdef V8_OS_WIN | 43 #ifdef V8_OS_WIN |
44 template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>; | 44 template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>; |
45 #endif | 45 #endif |
46 | 46 |
47 namespace v8 { | 47 namespace v8 { |
48 | 48 |
| 49 // TickSample captures the information collected for each sample. |
| 50 struct TickSample { |
| 51 // Internal profiling (with --prof + tools/$OS-tick-processor) wants to |
| 52 // include the runtime function we're calling. Externally exposed tick |
| 53 // samples don't care. |
| 54 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; |
| 55 |
| 56 TickSample() |
| 57 : state(OTHER), |
| 58 pc(NULL), |
| 59 external_callback_entry(NULL), |
| 60 frames_count(0), |
| 61 has_external_callback(false), |
| 62 update_stats(true) {} |
| 63 void Init(Isolate* isolate, const v8::RegisterState& state, |
| 64 RecordCEntryFrame record_c_entry_frame, bool update_stats); |
| 65 static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, |
| 66 RecordCEntryFrame record_c_entry_frame, |
| 67 void** frames, size_t frames_limit, |
| 68 v8::SampleInfo* sample_info); |
| 69 StateTag state; // The state of the VM. |
| 70 void* pc; // Instruction pointer. |
| 71 union { |
| 72 void* tos; // Top stack value (*sp). |
| 73 void* external_callback_entry; |
| 74 }; |
| 75 static const unsigned kMaxFramesCountLog2 = 8; |
| 76 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; |
| 77 void* stack[kMaxFramesCount]; // Call stack. |
| 78 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
| 79 bool has_external_callback : 1; |
| 80 bool update_stats : 1; // Whether the sample should update aggregated stats. |
| 81 }; |
| 82 |
49 /** | 83 /** |
50 * CpuProfileNode represents a node in a call graph. | 84 * CpuProfileNode represents a node in a call graph. |
51 */ | 85 */ |
52 class V8_EXPORT CpuProfileNode { | 86 class V8_EXPORT CpuProfileNode { |
53 public: | 87 public: |
54 struct LineTick { | 88 struct LineTick { |
55 /** The 1-based number of the source line where the function originates. */ | 89 /** The 1-based number of the source line where the function originates. */ |
56 int line; | 90 int line; |
57 | 91 |
58 /** The count of samples associated with the source line. */ | 92 /** The count of samples associated with the source line. */ |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 uint32_t index; // Index of the time interval that was changed. | 812 uint32_t index; // Index of the time interval that was changed. |
779 uint32_t count; // New value of count field for the interval with this index. | 813 uint32_t count; // New value of count field for the interval with this index. |
780 uint32_t size; // New value of size field for the interval with this index. | 814 uint32_t size; // New value of size field for the interval with this index. |
781 }; | 815 }; |
782 | 816 |
783 | 817 |
784 } // namespace v8 | 818 } // namespace v8 |
785 | 819 |
786 | 820 |
787 #endif // V8_V8_PROFILER_H_ | 821 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |