Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: include/v8-profiler.h

Issue 13460002: Isolatify CPU profiler public API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 unsigned GetUid() const; 128 unsigned GetUid() const;
129 129
130 /** Returns CPU profile title. */ 130 /** Returns CPU profile title. */
131 Handle<String> GetTitle() const; 131 Handle<String> GetTitle() const;
132 132
133 /** Returns the root node of the top down call tree. */ 133 /** Returns the root node of the top down call tree. */
134 const CpuProfileNode* GetTopDownRoot() const; 134 const CpuProfileNode* GetTopDownRoot() const;
135 135
136 /** 136 /**
137 * Returns number of samples recorded. The samples are not recorded unless 137 * Returns number of samples recorded. The samples are not recorded unless
138 * |record_samples| parameter of CpuProfiler::StartProfiling is true. 138 * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true.
139 */ 139 */
140 int GetSamplesCount() const; 140 int GetSamplesCount() const;
141 141
142 /** 142 /**
143 * Returns profile node corresponding to the top frame the sample at 143 * Returns profile node corresponding to the top frame the sample at
144 * the given index. 144 * the given index.
145 */ 145 */
146 const CpuProfileNode* GetSample(int index) const; 146 const CpuProfileNode* GetSample(int index) const;
147 147
148 /** 148 /**
149 * Deletes the profile and removes it from CpuProfiler's list. 149 * Deletes the profile and removes it from CpuProfiler's list.
150 * All pointers to nodes previously returned become invalid. 150 * All pointers to nodes previously returned become invalid.
151 * Profiles with the same uid but obtained using different 151 * Profiles with the same uid but obtained using different
152 * security token are not deleted, but become inaccessible 152 * security token are not deleted, but become inaccessible
153 * using FindProfile method. It is embedder's responsibility 153 * using FindProfile method. It is embedder's responsibility
154 * to call Delete on these profiles. 154 * to call Delete on these profiles.
155 */ 155 */
156 void Delete(); 156 void Delete();
157 }; 157 };
158 158
159 159
160 /** 160 /**
161 * Interface for controlling CPU profiling. 161 * Interface for controlling CPU profiling. Instance of the
162 * profiler can be retrieved using v8::Isolate::GetCpuProfiler.
162 */ 163 */
163 class V8EXPORT CpuProfiler { 164 class V8EXPORT CpuProfiler {
164 public: 165 public:
165 /** 166 /**
166 * A note on security tokens usage. As scripts from different 167 * A note on security tokens usage. As scripts from different
167 * origins can run inside a single V8 instance, it is possible to 168 * origins can run inside a single V8 instance, it is possible to
168 * have functions from different security contexts intermixed in a 169 * have functions from different security contexts intermixed in a
169 * single CPU profile. To avoid exposing function names belonging to 170 * single CPU profile. To avoid exposing function names belonging to
170 * other contexts, filtering by security token is performed while 171 * other contexts, filtering by security token is performed while
171 * obtaining profiling results. 172 * obtaining profiling results.
172 */ 173 */
173 174
175 /** Deprecated. Use GetProfileCount instead. */
176 static int GetProfilesCount();
174 /** 177 /**
175 * Returns the number of profiles collected (doesn't include 178 * Returns the number of profiles collected (doesn't include
176 * profiles that are being collected at the moment of call.) 179 * profiles that are being collected at the moment of call.)
177 */ 180 */
178 static int GetProfilesCount(); 181 int GetProfileCount();
179 182
180 /** Returns a profile by index. */ 183 /** Deprecated. Use GetCpuProfile instead. */
181 static const CpuProfile* GetProfile( 184 static const CpuProfile* GetProfile(
182 int index, 185 int index,
183 Handle<Value> security_token = Handle<Value>()); 186 Handle<Value> security_token = Handle<Value>());
187 /** Returns a profile by index. */
188 const CpuProfile* GetCpuProfile(
189 int index,
190 Handle<Value> security_token = Handle<Value>());
184 191
185 /** Returns a profile by uid. */ 192 /** Deprecated. Use FindProfile instead. */
186 static const CpuProfile* FindProfile( 193 static const CpuProfile* FindProfile(
187 unsigned uid, 194 unsigned uid,
188 Handle<Value> security_token = Handle<Value>()); 195 Handle<Value> security_token = Handle<Value>());
196 /** Returns a profile by uid. */
197 const CpuProfile* FindCpuProfile(
198 unsigned uid,
199 Handle<Value> security_token = Handle<Value>());
189 200
201 /** Deprecated. Use StartCpuProfiling instead. */
202 static void StartProfiling(Handle<String> title, bool record_samples = false);
190 /** 203 /**
191 * Starts collecting CPU profile. Title may be an empty string. It 204 * Starts collecting CPU profile. Title may be an empty string. It
192 * is allowed to have several profiles being collected at 205 * is allowed to have several profiles being collected at
193 * once. Attempts to start collecting several profiles with the same 206 * once. Attempts to start collecting several profiles with the same
194 * title are silently ignored. While collecting a profile, functions 207 * title are silently ignored. While collecting a profile, functions
195 * from all security contexts are included in it. The token-based 208 * from all security contexts are included in it. The token-based
196 * filtering is only performed when querying for a profile. 209 * filtering is only performed when querying for a profile.
197 * 210 *
198 * |record_samples| parameter controls whether individual samples should 211 * |record_samples| parameter controls whether individual samples should
199 * be recorded in addition to the aggregated tree. 212 * be recorded in addition to the aggregated tree.
200 */ 213 */
201 static void StartProfiling(Handle<String> title, bool record_samples = false); 214 void StartCpuProfiling(Handle<String> title, bool record_samples = false);
202 215
216 /** Deprecated. Use StopCpuProfiling instead. */
217 static const CpuProfile* StopProfiling(
218 Handle<String> title,
219 Handle<Value> security_token = Handle<Value>());
203 /** 220 /**
204 * Stops collecting CPU profile with a given title and returns it. 221 * Stops collecting CPU profile with a given title and returns it.
205 * If the title given is empty, finishes the last profile started. 222 * If the title given is empty, finishes the last profile started.
206 */ 223 */
207 static const CpuProfile* StopProfiling( 224 const CpuProfile* StopCpuProfiling(
208 Handle<String> title, 225 Handle<String> title,
209 Handle<Value> security_token = Handle<Value>()); 226 Handle<Value> security_token = Handle<Value>());
210 227
228 /** Deprecated. Use DeleteAllCpuProfiles instead. */
229 static void DeleteAllProfiles();
211 /** 230 /**
212 * Deletes all existing profiles, also cancelling all profiling 231 * Deletes all existing profiles, also cancelling all profiling
213 * activity. All previously returned pointers to profiles and their 232 * activity. All previously returned pointers to profiles and their
214 * contents become invalid after this call. 233 * contents become invalid after this call.
215 */ 234 */
216 static void DeleteAllProfiles(); 235 void DeleteAllCpuProfiles();
236
237 private:
238 CpuProfiler();
239 ~CpuProfiler();
240 CpuProfiler(const CpuProfiler&);
241 CpuProfiler& operator=(const CpuProfiler&);
217 }; 242 };
218 243
219 244
220 class HeapGraphNode; 245 class HeapGraphNode;
221 246
222 247
223 /** 248 /**
224 * HeapSnapshotEdge represents a directed connection between heap 249 * HeapSnapshotEdge represents a directed connection between heap
225 * graph nodes: from retainers to retained nodes. 250 * graph nodes: from retainers to retained nodes.
226 */ 251 */
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 }; 646 };
622 647
623 648
624 } // namespace v8 649 } // namespace v8
625 650
626 651
627 #undef V8EXPORT 652 #undef V8EXPORT
628 653
629 654
630 #endif // V8_V8_PROFILER_H_ 655 #endif // V8_V8_PROFILER_H_
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698