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

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

Issue 196383015: Move profiler callback interfaces from v8.h to v8-profiler.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 17 matching lines...) Expand all
28 #ifndef V8_V8_PROFILER_H_ 28 #ifndef V8_V8_PROFILER_H_
29 #define V8_V8_PROFILER_H_ 29 #define V8_V8_PROFILER_H_
30 30
31 #include "v8.h" 31 #include "v8.h"
32 32
33 /** 33 /**
34 * Profiler support for the V8 JavaScript engine. 34 * Profiler support for the V8 JavaScript engine.
35 */ 35 */
36 namespace v8 { 36 namespace v8 {
37 37
38 class HeapGraphNode;
39 class HeapStatsUpdate;
40
38 typedef uint32_t SnapshotObjectId; 41 typedef uint32_t SnapshotObjectId;
39 42
40 /** 43 /**
41 * CpuProfileNode represents a node in a call graph. 44 * CpuProfileNode represents a node in a call graph.
42 */ 45 */
43 class V8_EXPORT CpuProfileNode { 46 class V8_EXPORT CpuProfileNode {
44 public: 47 public:
45 /** Returns function name (empty string for anonymous functions.) */ 48 /** Returns function name (empty string for anonymous functions.) */
46 Handle<String> GetFunctionName() const; 49 Handle<String> GetFunctionName() const;
47 50
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void SetIdle(bool is_idle); 175 void SetIdle(bool is_idle);
173 176
174 private: 177 private:
175 CpuProfiler(); 178 CpuProfiler();
176 ~CpuProfiler(); 179 ~CpuProfiler();
177 CpuProfiler(const CpuProfiler&); 180 CpuProfiler(const CpuProfiler&);
178 CpuProfiler& operator=(const CpuProfiler&); 181 CpuProfiler& operator=(const CpuProfiler&);
179 }; 182 };
180 183
181 184
182 class HeapGraphNode;
183
184
185 /** 185 /**
186 * HeapSnapshotEdge represents a directed connection between heap 186 * HeapSnapshotEdge represents a directed connection between heap
187 * graph nodes: from retainers to retained nodes. 187 * graph nodes: from retainers to retained nodes.
188 */ 188 */
189 class V8_EXPORT HeapGraphEdge { 189 class V8_EXPORT HeapGraphEdge {
190 public: 190 public:
191 enum Type { 191 enum Type {
192 kContextVariable = 0, // A variable from a function context. 192 kContextVariable = 0, // A variable from a function context.
193 kElement = 1, // An element of an array. 193 kElement = 1, // An element of an array.
194 kProperty = 2, // A named object property. 194 kProperty = 2, // A named object property.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 /** Returns child nodes count of the node. */ 266 /** Returns child nodes count of the node. */
267 int GetChildrenCount() const; 267 int GetChildrenCount() const;
268 268
269 /** Retrieves a child by index. */ 269 /** Retrieves a child by index. */
270 const HeapGraphEdge* GetChild(int index) const; 270 const HeapGraphEdge* GetChild(int index) const;
271 }; 271 };
272 272
273 273
274 /** 274 /**
275 * An interface for exporting data from V8, using "push" model.
276 */
277 class V8_EXPORT OutputStream { // NOLINT
278 public:
279 enum WriteResult {
280 kContinue = 0,
281 kAbort = 1
282 };
283 virtual ~OutputStream() {}
284 /** Notify about the end of stream. */
285 virtual void EndOfStream() = 0;
286 /** Get preferred output chunk size. Called only once. */
287 virtual int GetChunkSize() { return 1024; }
288 /**
289 * Writes the next chunk of snapshot data into the stream. Writing
290 * can be stopped by returning kAbort as function result. EndOfStream
291 * will not be called in case writing was aborted.
292 */
293 virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
294 /**
295 * Writes the next chunk of heap stats data into the stream. Writing
296 * can be stopped by returning kAbort as function result. EndOfStream
297 * will not be called in case writing was aborted.
298 */
299 virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
300 return kAbort;
301 };
302 };
303
304
305 /**
275 * HeapSnapshots record the state of the JS heap at some moment. 306 * HeapSnapshots record the state of the JS heap at some moment.
276 */ 307 */
277 class V8_EXPORT HeapSnapshot { 308 class V8_EXPORT HeapSnapshot {
278 public: 309 public:
279 enum SerializationFormat { 310 enum SerializationFormat {
280 kJSON = 0 // See format description near 'Serialize' method. 311 kJSON = 0 // See format description near 'Serialize' method.
281 }; 312 };
282 313
283 /** Returns heap snapshot UID (assigned by the profiler.) */ 314 /** Returns heap snapshot UID (assigned by the profiler.) */
284 unsigned GetUid() const; 315 unsigned GetUid() const;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 * strings: [strings array] 362 * strings: [strings array]
332 * } 363 * }
333 * 364 *
334 * Nodes reference strings, other nodes, and edges by their indexes 365 * Nodes reference strings, other nodes, and edges by their indexes
335 * in corresponding arrays. 366 * in corresponding arrays.
336 */ 367 */
337 void Serialize(OutputStream* stream, SerializationFormat format) const; 368 void Serialize(OutputStream* stream, SerializationFormat format) const;
338 }; 369 };
339 370
340 371
341 class RetainedObjectInfo; 372 /**
373 * An interface for reporting progress and controlling long-running
374 * activities.
375 */
376 class V8_EXPORT ActivityControl { // NOLINT
377 public:
378 enum ControlOption {
379 kContinue = 0,
380 kAbort = 1
381 };
382 virtual ~ActivityControl() {}
383 /**
384 * Notify about current progress. The activity can be stopped by
385 * returning kAbort as the callback result.
386 */
387 virtual ControlOption ReportProgressValue(int done, int total) = 0;
388 };
389
342 390
343 /** 391 /**
344 * Interface for controlling heap profiling. Instance of the 392 * Interface for controlling heap profiling. Instance of the
345 * profiler can be retrieved using v8::Isolate::GetHeapProfiler. 393 * profiler can be retrieved using v8::Isolate::GetHeapProfiler.
346 */ 394 */
347 class V8_EXPORT HeapProfiler { 395 class V8_EXPORT HeapProfiler {
348 public: 396 public:
349 /** 397 /**
350 * Callback function invoked for obtaining RetainedObjectInfo for 398 * Callback function invoked for obtaining RetainedObjectInfo for
351 * the given JavaScript wrapper object. It is prohibited to enter V8 399 * the given JavaScript wrapper object. It is prohibited to enter V8
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 uint32_t index; // Index of the time interval that was changed. 607 uint32_t index; // Index of the time interval that was changed.
560 uint32_t count; // New value of count field for the interval with this index. 608 uint32_t count; // New value of count field for the interval with this index.
561 uint32_t size; // New value of size field for the interval with this index. 609 uint32_t size; // New value of size field for the interval with this index.
562 }; 610 };
563 611
564 612
565 } // namespace v8 613 } // namespace v8
566 614
567 615
568 #endif // V8_V8_PROFILER_H_ 616 #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