OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 static const int kNoColumnNumberInfo = Message::kNoColumnInfo; | 89 static const int kNoColumnNumberInfo = Message::kNoColumnInfo; |
90 }; | 90 }; |
91 | 91 |
92 | 92 |
93 /** | 93 /** |
94 * CpuProfile contains a CPU profile in a form of top-down call tree | 94 * CpuProfile contains a CPU profile in a form of top-down call tree |
95 * (from main() down to functions that do all the work). | 95 * (from main() down to functions that do all the work). |
96 */ | 96 */ |
97 class V8_EXPORT CpuProfile { | 97 class V8_EXPORT CpuProfile { |
98 public: | 98 public: |
99 /** Returns CPU profile UID (assigned by the profiler.) */ | |
100 unsigned GetUid() const; | |
101 | |
102 /** Returns CPU profile title. */ | 99 /** Returns CPU profile title. */ |
103 Handle<String> GetTitle() const; | 100 Handle<String> GetTitle() const; |
104 | 101 |
105 /** Returns the root node of the top down call tree. */ | 102 /** Returns the root node of the top down call tree. */ |
106 const CpuProfileNode* GetTopDownRoot() const; | 103 const CpuProfileNode* GetTopDownRoot() const; |
107 | 104 |
108 /** | 105 /** |
109 * Returns number of samples recorded. The samples are not recorded unless | 106 * Returns number of samples recorded. The samples are not recorded unless |
110 * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. | 107 * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. |
111 */ | 108 */ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 class V8_EXPORT CpuProfiler { | 141 class V8_EXPORT CpuProfiler { |
145 public: | 142 public: |
146 /** | 143 /** |
147 * Changes default CPU profiler sampling interval to the specified number | 144 * Changes default CPU profiler sampling interval to the specified number |
148 * of microseconds. Default interval is 1000us. This method must be called | 145 * of microseconds. Default interval is 1000us. This method must be called |
149 * when there are no profiles being recorded. | 146 * when there are no profiles being recorded. |
150 */ | 147 */ |
151 void SetSamplingInterval(int us); | 148 void SetSamplingInterval(int us); |
152 | 149 |
153 /** | 150 /** |
154 * Returns the number of profiles collected (doesn't include | |
155 * profiles that are being collected at the moment of call.) | |
156 */ | |
157 int GetProfileCount(); | |
158 | |
159 /** Returns a profile by index. */ | |
160 const CpuProfile* GetCpuProfile(int index); | |
161 | |
162 /** | |
163 * Starts collecting CPU profile. Title may be an empty string. It | 151 * Starts collecting CPU profile. Title may be an empty string. It |
164 * is allowed to have several profiles being collected at | 152 * is allowed to have several profiles being collected at |
165 * once. Attempts to start collecting several profiles with the same | 153 * once. Attempts to start collecting several profiles with the same |
166 * title are silently ignored. While collecting a profile, functions | 154 * title are silently ignored. While collecting a profile, functions |
167 * from all security contexts are included in it. The token-based | 155 * from all security contexts are included in it. The token-based |
168 * filtering is only performed when querying for a profile. | 156 * filtering is only performed when querying for a profile. |
169 * | 157 * |
170 * |record_samples| parameter controls whether individual samples should | 158 * |record_samples| parameter controls whether individual samples should |
171 * be recorded in addition to the aggregated tree. | 159 * be recorded in addition to the aggregated tree. |
172 */ | 160 */ |
173 void StartCpuProfiling(Handle<String> title, bool record_samples = false); | 161 void StartCpuProfiling(Handle<String> title, bool record_samples = false); |
174 | 162 |
175 /** | 163 /** |
176 * Stops collecting CPU profile with a given title and returns it. | 164 * Stops collecting CPU profile with a given title and returns it. |
177 * If the title given is empty, finishes the last profile started. | 165 * If the title given is empty, finishes the last profile started. |
178 */ | 166 */ |
179 const CpuProfile* StopCpuProfiling(Handle<String> title); | 167 const CpuProfile* StopCpuProfiling(Handle<String> title); |
180 | 168 |
181 /** | 169 /** |
182 * Deletes all existing profiles, also cancelling all profiling | |
183 * activity. All previously returned pointers to profiles and their | |
184 * contents become invalid after this call. | |
185 */ | |
186 void DeleteAllCpuProfiles(); | |
187 | |
188 /** | |
189 * Tells the profiler whether the embedder is idle. | 170 * Tells the profiler whether the embedder is idle. |
190 */ | 171 */ |
191 void SetIdle(bool is_idle); | 172 void SetIdle(bool is_idle); |
192 | 173 |
193 private: | 174 private: |
194 CpuProfiler(); | 175 CpuProfiler(); |
195 ~CpuProfiler(); | 176 ~CpuProfiler(); |
196 CpuProfiler(const CpuProfiler&); | 177 CpuProfiler(const CpuProfiler&); |
197 CpuProfiler& operator=(const CpuProfiler&); | 178 CpuProfiler& operator=(const CpuProfiler&); |
198 }; | 179 }; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 uint32_t index; // Index of the time interval that was changed. | 563 uint32_t index; // Index of the time interval that was changed. |
583 uint32_t count; // New value of count field for the interval with this index. | 564 uint32_t count; // New value of count field for the interval with this index. |
584 uint32_t size; // New value of size field for the interval with this index. | 565 uint32_t size; // New value of size field for the interval with this index. |
585 }; | 566 }; |
586 | 567 |
587 | 568 |
588 } // namespace v8 | 569 } // namespace v8 |
589 | 570 |
590 | 571 |
591 #endif // V8_V8_PROFILER_H_ | 572 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |