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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 /** Returns the count of samples where function exists. */ | 99 /** Returns the count of samples where function exists. */ |
100 double GetTotalSamplesCount() const; | 100 double GetTotalSamplesCount() const; |
101 | 101 |
102 /** Returns the count of samples where function was currently executing. */ | 102 /** Returns the count of samples where function was currently executing. */ |
103 double GetSelfSamplesCount() const; | 103 double GetSelfSamplesCount() const; |
104 | 104 |
105 /** Returns function entry UID. */ | 105 /** Returns function entry UID. */ |
106 unsigned GetCallUid() const; | 106 unsigned GetCallUid() const; |
107 | 107 |
| 108 /** Returns id of the node. The id is unique within the tree */ |
| 109 unsigned GetNodeId() const; |
| 110 |
108 /** Returns child nodes count of the node. */ | 111 /** Returns child nodes count of the node. */ |
109 int GetChildrenCount() const; | 112 int GetChildrenCount() const; |
110 | 113 |
111 /** Retrieves a child node by index. */ | 114 /** Retrieves a child node by index. */ |
112 const CpuProfileNode* GetChild(int index) const; | 115 const CpuProfileNode* GetChild(int index) const; |
113 | 116 |
114 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; | 117 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; |
115 }; | 118 }; |
116 | 119 |
117 | 120 |
118 /** | 121 /** |
119 * CpuProfile contains a CPU profile in a form of top-down call tree | 122 * CpuProfile contains a CPU profile in a form of top-down call tree |
120 * (from main() down to functions that do all the work). | 123 * (from main() down to functions that do all the work). |
121 */ | 124 */ |
122 class V8EXPORT CpuProfile { | 125 class V8EXPORT CpuProfile { |
123 public: | 126 public: |
124 /** Returns CPU profile UID (assigned by the profiler.) */ | 127 /** Returns CPU profile UID (assigned by the profiler.) */ |
125 unsigned GetUid() const; | 128 unsigned GetUid() const; |
126 | 129 |
127 /** Returns CPU profile title. */ | 130 /** Returns CPU profile title. */ |
128 Handle<String> GetTitle() const; | 131 Handle<String> GetTitle() const; |
129 | 132 |
130 /** Returns the root node of the top down call tree. */ | 133 /** Returns the root node of the top down call tree. */ |
131 const CpuProfileNode* GetTopDownRoot() const; | 134 const CpuProfileNode* GetTopDownRoot() const; |
132 | 135 |
133 /** | 136 /** |
| 137 * Returns number of samples recorded. The samples are not recorded unless |
| 138 * |record_samples| parameter of CpuProfiler::StartProfiling is true. |
| 139 */ |
| 140 int GetSamplesCount() const; |
| 141 |
| 142 /** |
| 143 * Returns profile node corresponding to the top frame the sample at |
| 144 * the given index. |
| 145 */ |
| 146 const CpuProfileNode* GetSample(int index) const; |
| 147 |
| 148 /** |
134 * Deletes the profile and removes it from CpuProfiler's list. | 149 * Deletes the profile and removes it from CpuProfiler's list. |
135 * All pointers to nodes previously returned become invalid. | 150 * All pointers to nodes previously returned become invalid. |
136 * Profiles with the same uid but obtained using different | 151 * Profiles with the same uid but obtained using different |
137 * security token are not deleted, but become inaccessible | 152 * security token are not deleted, but become inaccessible |
138 * using FindProfile method. It is embedder's responsibility | 153 * using FindProfile method. It is embedder's responsibility |
139 * to call Delete on these profiles. | 154 * to call Delete on these profiles. |
140 */ | 155 */ |
141 void Delete(); | 156 void Delete(); |
142 }; | 157 }; |
143 | 158 |
(...skipping 28 matching lines...) Expand all Loading... |
172 unsigned uid, | 187 unsigned uid, |
173 Handle<Value> security_token = Handle<Value>()); | 188 Handle<Value> security_token = Handle<Value>()); |
174 | 189 |
175 /** | 190 /** |
176 * Starts collecting CPU profile. Title may be an empty string. It | 191 * Starts collecting CPU profile. Title may be an empty string. It |
177 * is allowed to have several profiles being collected at | 192 * is allowed to have several profiles being collected at |
178 * once. Attempts to start collecting several profiles with the same | 193 * once. Attempts to start collecting several profiles with the same |
179 * title are silently ignored. While collecting a profile, functions | 194 * title are silently ignored. While collecting a profile, functions |
180 * from all security contexts are included in it. The token-based | 195 * from all security contexts are included in it. The token-based |
181 * filtering is only performed when querying for a profile. | 196 * filtering is only performed when querying for a profile. |
| 197 * |
| 198 * |record_samples| parameter controls whether individual samples should |
| 199 * be recorded in addition to the aggregated tree. |
182 */ | 200 */ |
183 static void StartProfiling(Handle<String> title); | 201 static void StartProfiling(Handle<String> title, bool record_samples = false); |
184 | 202 |
185 /** | 203 /** |
186 * Stops collecting CPU profile with a given title and returns it. | 204 * Stops collecting CPU profile with a given title and returns it. |
187 * If the title given is empty, finishes the last profile started. | 205 * If the title given is empty, finishes the last profile started. |
188 */ | 206 */ |
189 static const CpuProfile* StopProfiling( | 207 static const CpuProfile* StopProfiling( |
190 Handle<String> title, | 208 Handle<String> title, |
191 Handle<Value> security_token = Handle<Value>()); | 209 Handle<Value> security_token = Handle<Value>()); |
192 | 210 |
193 /** | 211 /** |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 }; | 585 }; |
568 | 586 |
569 | 587 |
570 } // namespace v8 | 588 } // namespace v8 |
571 | 589 |
572 | 590 |
573 #undef V8EXPORT | 591 #undef V8EXPORT |
574 | 592 |
575 | 593 |
576 #endif // V8_V8_PROFILER_H_ | 594 #endif // V8_V8_PROFILER_H_ |
OLD | NEW |