Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 // samples don't care. | 53 // samples don't care. |
| 54 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; | 54 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; |
| 55 | 55 |
| 56 TickSample() | 56 TickSample() |
| 57 : state(OTHER), | 57 : state(OTHER), |
| 58 pc(nullptr), | 58 pc(nullptr), |
| 59 external_callback_entry(nullptr), | 59 external_callback_entry(nullptr), |
| 60 frames_count(0), | 60 frames_count(0), |
| 61 has_external_callback(false), | 61 has_external_callback(false), |
| 62 update_stats(true) {} | 62 update_stats(true) {} |
| 63 | |
| 64 /** | |
| 65 * Initialize a tick sample from the isolate. | |
| 66 * \param isolate The isolate. | |
| 67 * \param state Execution state. | |
| 68 * \param record_c_entry_frame Include or skip the runtime function. | |
| 69 * \param update_stats Whether update the sample to the aggregated stats. | |
| 70 * \param update_state If set to true, V8 will update the register state | |
|
alph
2016/08/09 19:03:41
Please change description to something like:
When
lpy
2016/08/10 05:50:03
Done.
| |
| 71 when running on simulator. Default value is true, | |
|
alph
2016/08/09 19:03:41
missing *
lpy
2016/08/10 05:50:03
Done.
| |
| 72 unless the register state is absolutely correct, | |
| 73 otherwise don't use it. | |
| 74 */ | |
| 63 void Init(Isolate* isolate, const v8::RegisterState& state, | 75 void Init(Isolate* isolate, const v8::RegisterState& state, |
| 64 RecordCEntryFrame record_c_entry_frame, bool update_stats); | 76 RecordCEntryFrame record_c_entry_frame, bool update_stats, |
| 65 static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, | 77 bool update_state = true); |
| 78 /** | |
| 79 * Get a call stack sample from the isolate. | |
| 80 * \param isolate The isolate. | |
| 81 * \param state Register state. | |
| 82 * \param record_c_entry_frame Include or skip the runtime function. | |
| 83 * \param frames Caller allocated buffer to store stack frames. | |
| 84 * \param frames_limit Maximum number of frames to capture. The buffer must | |
| 85 * be large enough to hold the number of frames. | |
| 86 * \param sample_info The sample info is filled up by the function | |
| 87 * provides number of actual captured stack frames and | |
| 88 * the current VM state. | |
| 89 * \param update_state If set to true, V8 will update the given register state | |
| 90 when running on simulator. Default value is true, | |
|
alph
2016/08/09 19:03:41
Missing *
lpy
2016/08/10 05:50:03
Done.
| |
| 91 unless the register state is absolutely correct, | |
| 92 otherwise don't use it. | |
| 93 * \note GetStackSample is thread and signal safe and should only be called | |
| 94 * when the JS thread is paused or interrupted. | |
| 95 * Otherwise the behavior is undefined. | |
| 96 */ | |
| 97 static bool GetStackSample(Isolate* isolate, v8::RegisterState* state, | |
| 66 RecordCEntryFrame record_c_entry_frame, | 98 RecordCEntryFrame record_c_entry_frame, |
| 67 void** frames, size_t frames_limit, | 99 void** frames, size_t frames_limit, |
| 68 v8::SampleInfo* sample_info); | 100 v8::SampleInfo* sample_info, |
| 101 bool update_state = true); | |
|
alph
2016/08/09 19:03:41
I'd still mention the word simulator here, as othe
lpy
2016/08/10 05:50:03
Done.
| |
| 69 StateTag state; // The state of the VM. | 102 StateTag state; // The state of the VM. |
| 70 void* pc; // Instruction pointer. | 103 void* pc; // Instruction pointer. |
| 71 union { | 104 union { |
| 72 void* tos; // Top stack value (*sp). | 105 void* tos; // Top stack value (*sp). |
| 73 void* external_callback_entry; | 106 void* external_callback_entry; |
| 74 }; | 107 }; |
| 75 static const unsigned kMaxFramesCountLog2 = 8; | 108 static const unsigned kMaxFramesCountLog2 = 8; |
| 76 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; | 109 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; |
| 77 void* stack[kMaxFramesCount]; // Call stack. | 110 void* stack[kMaxFramesCount]; // Call stack. |
| 78 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. | 111 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 uint32_t index; // Index of the time interval that was changed. | 858 uint32_t index; // Index of the time interval that was changed. |
| 826 uint32_t count; // New value of count field for the interval with this index. | 859 uint32_t count; // New value of count field for the interval with this index. |
| 827 uint32_t size; // New value of size field for the interval with this index. | 860 uint32_t size; // New value of size field for the interval with this index. |
| 828 }; | 861 }; |
| 829 | 862 |
| 830 | 863 |
| 831 } // namespace v8 | 864 } // namespace v8 |
| 832 | 865 |
| 833 | 866 |
| 834 #endif // V8_V8_PROFILER_H_ | 867 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |